Issue
I know there's a lot of similar posts on this issue on Stack Overflow; (link, href="https://stackoverflow.com/questions/39343001/chrome-browser-is-not-opening-in-selenium-webdriver">link, link, etc.) but none of them seem to resolve my problem; in which I have updated the Chromedriver version to the latest Chrome version that I am using, but it appears as though it is just not starting / opening Chrome at all. Can anyone suggest something that I am doing wrong?
- Chrome version: 103.0.5060.114 (Official Build) (64-bit) (cohort: Stable)
- Chromedriver version: ChromeDriver 103.0.5060.53 (https://chromedriver.storage.googleapis.com/index.html?path=103.0.5060.53/)
- Java Selenium version (via Maven): 3.141.59
Code:
logger.info("*** Chrome Simulation(): default viewport");
String exePath = System.getProperty(USER_DIR) + "\\src\\main\\resources\\chromedriver.exe";
System.setProperty("webdriver.chrome.driver", exePath);
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--start-maximized");
// chromeOptions.addArguments("--headless");
// chromeOptions.addArguments("--disable-gpu");
// chromeOptions.addArguments("--window-size=1920,1080");
driver = new ChromeDriver(chromeOptions);
driver.get(browserMeta.getProperties().getProperty(DESKTOP_URL));
When I try to run the code using a maven command:
mvn test "-Dcucumber.options=--tags '@Test'" -Denv=t1 -Dopenreport=false -DforkCount=0 -DreuseForks=false
to start the execution but I get the following error message / stacktrace:
Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '[REDACTED FOR SAFETY REASONS]', ip: '[REDACTED FOR SAFETY REASONS]', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161'
Driver info: driver.version: ChromeDriver
org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:202)
org.openqa.selenium.remote.service.DriverService.start(DriverService.java:188)
org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
[MY-ORG-PATH](MyFile:MyLineNumber)
[MY-ORG-PATH](MyFile:MyLineNumber)
[MY-ORG-PATH](MyFile:MyLineNumber)
[MY-ORG-PATH](MyFile:MyLineNumber)
sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
io.cucumber.java.Invoker.doInvoke(Invoker.java:66)
io.cucumber.java.Invoker.invoke(Invoker.java:24)
io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
io.cucumber.java.JavaHookDefinition.execute(JavaHookDefinition.java:59)
io.cucumber.core.runner.CoreHookDefinition.execute(CoreHookDefinition.java:46)
io.cucumber.core.runner.HookDefinitionMatch.runStep(HookDefinitionMatch.java:21)
io.cucumber.core.runner.ExecutionMode$1.execute(ExecutionMode.java:10)
io.cucumber.core.runner.TestStep.executeStep(TestStep.java:92)
io.cucumber.core.runner.TestStep.run(TestStep.java:64)
io.cucumber.core.runner.TestCase.run(TestCase.java:98)
io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:151)
io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:135)
io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:27)
org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
org.junit.runners.ParentRunner.run(ParentRunner.java:413)
io.cucumber.junit.Cucumber.runChild(Cucumber.java:199)
io.cucumber.junit.Cucumber.runChild(Cucumber.java:90)
org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
io.cucumber.junit.Cucumber$RunCucumber.evaluate(Cucumber.java:234)
org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
org.junit.runners.ParentRunner.run(ParentRunner.java:413)
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:364)
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272)
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:237)
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:158)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.apache.maven.surefire.api.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:167)
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:161)
org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:84)
org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess(InPluginVMSurefireStarter.java:87)
org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1295)
org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1159)
org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:932)
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Solution
Following on from the chat in the Selenium room with @undetected-selenium I managed to get it working; but it wasn't just Selenium that I had to upgrade. Part of my pom.xml files were interrelated and I also had to upgrade the following elements; which I was also using:
- cucumber-java to v7.3.3
- cucumber-junit to v7.3.3
- commons-io to v2.11.0
- cucumber-core to v7.3.3
Once I had these upgraded; the solution worked as previously mentioned.
Answered By - Raisus
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)