File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package testUI ;
22
33import com .codeborne .selenide .AssertionMode ;
4+ import org .openqa .selenium .chrome .ChromeOptions ;
5+ import org .openqa .selenium .firefox .FirefoxOptions ;
46import org .openqa .selenium .remote .DesiredCapabilities ;
57
68public class SelenideConfiguration {
@@ -34,5 +36,7 @@ public class SelenideConfiguration {
3436// public static boolean driverManagerEnabled;
3537 public static boolean headless = false ;
3638 public static String browserBinary = "" ;
39+ public static ChromeOptions chromeOptions ;
40+ public static FirefoxOptions firefoxOptions ;
3741
3842}
Original file line number Diff line number Diff line change 55import io .appium .java_client .service .local .AppiumDriverLocalService ;
66import io .qameta .allure .Allure ;
77import org .openqa .selenium .JavascriptExecutor ;
8+ import org .openqa .selenium .chrome .ChromeDriver ;
9+ import org .openqa .selenium .firefox .FirefoxDriver ;
810import testUI .Utils .TestUIException ;
911
1012import java .util .ArrayList ;
@@ -188,8 +190,28 @@ private static void setUpSelenideVariables() {
188190 ? defaults .browserPosition () : Configuration .browserPosition ;
189191 }
190192
193+ private static void setChromeDriver () {
194+ if (Configuration .chromeOptions != null && Configuration .browser .toLowerCase ().equals (
195+ "chrome" )) {
196+ ChromeDriver driver = new ChromeDriver (Configuration .chromeOptions );
197+ setDriver (driver );
198+ Runtime .getRuntime ().addShutdownHook (new Thread (driver ::close ));
199+ }
200+ }
201+
202+ private static void setFirefoxDriver () {
203+ if (Configuration .firefoxOptions != null && Configuration .browser .toLowerCase ().equals (
204+ "firefox" )) {
205+ FirefoxDriver driver = new FirefoxDriver (Configuration .firefoxOptions );
206+ setDriver (driver );
207+ Runtime .getRuntime ().addShutdownHook (new Thread (driver ::close ));
208+ }
209+ }
210+
191211 protected static void startSelenideDriver (String urlOrRelativeUrl ) {
192212 setUpSelenideVariables ();
213+ setChromeDriver ();
214+ setFirefoxDriver ();
193215 open (urlOrRelativeUrl );
194216 }
195217
Original file line number Diff line number Diff line change @@ -399,7 +399,7 @@ public UIElement sendKeys(CharSequence charSequence) {
399399 }
400400 long finalTime = System .currentTimeMillis () - t ;
401401 putLogDebug ("Send keys '" + charSequence + "' to element '" + stringElement +
402- " after " + finalTime + " ms" );
402+ "' after " + finalTime + " ms" );
403403 return getElementObject ();
404404 }
405405
Original file line number Diff line number Diff line change 55import org .junit .Test ;
66import org .openqa .selenium .chrome .ChromeDriver ;
77import org .openqa .selenium .chrome .ChromeOptions ;
8- import org .openqa .selenium .remote .DesiredCapabilities ;
98import pages .GoogleLandingPage ;
109import testUI .Configuration ;
1110import testUI .Utils .GridTestUI ;
You can’t perform that action at this time.
0 commit comments