Getting error while running selenium grid - selenium-webdriver

When using my code:
DesiredCapabilities caps = new DesiredCapabilities(); DesiredCapabilities.chrome();
caps.setCapability(CapabilityType.BROWSER_NAME, "Firefox"); caps.setPlatform(Platform.WINDOWS);
caps.setCapability(FirefoxDriver.MARIONETTE, value);
WebDriver driver = new RemoteWebDriver(new URL("localhost:4444/wd/hub"), caps);
driver.get("google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("BrowserStack");
element.submit();
System.out.println(driver.getTitle());
driver.quit();
I am getting the following error:
Unable to create new remote session. desired capabilities = Capabilities [{platform=WINDOWS}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
In selenium console window, and in command prompt I got this error :
Unable to create new instances on this machine. 18:01:04.489 INFO - Driver class not found: com.opera.core.systems.OperaDriver 18:01:04.490 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
18:01:04.499 INFO - Driver provider org.openqa.selenium.safari.SafariDriver
registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=,
platform=MAC}] does not match the current platform VISTA
2017-01-06:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
... 1 more
18:01:11.703 WARN - Exception: The best matching driver provider
org.openqa.selenium.edge.EdgeDriver can't create a new driver instance for
Capabilities [{platform=WINDOWS}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19
-0700'
Could you please tell me where is the problem in my code?

You are setting chrome capabilities DesiredCapabilities.chrome(); and in next lines Firefox capabilites caps.setCapability(CapabilityType.BROWSER_NAME, "Firefox"); caps.setCapability(FirefoxDriver.MARIONETTE, value);
What driver do you even want to create?

Related

Firefox driver not navigating to new tab

I am facing a problem when I run selenium tests on firefox driver. the issue is that the driver is not navigating to new tab. it open the tab, however the flow is not shifting. these are the dependencies I used in the pom :
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>2.2.0</version>
</dependency>
and this is the instance of firefox driver i am creating-
FirefoxDriverManager.getInstance().setup();
driver = new FirefoxDriver();
this is the import-
import io.github.bonigarcia.wdm.FirefoxDriverManager;
this is the piece of code I used to navigate to the new window.
public void switchToNewWindow() {
parentWindow = driver.getWindowHandle();
Set<String> handles = driver.getWindowHandles();
for (String windowHandle : handles) {
if (!windowHandle.equals(parentWindow)) {
driver.switchTo().window(windowHandle);
driver.manage().window().maximize();
}
}
}
the tests runs fine on chrome browser with out any issues.
this is the version of the firefox browser-
Version 61.0.2 (64-bit)
this is the error message. the locator it failed to detect is in the new tab, which the driver failed to switch to-
Testing started at 16:03 ...
"C:\Program Files\Java\jdk1.8.0_161\bin\java" -Dorg.jetbrains.run.directory=C:\Users\rajeshg\IdeaProjects\nxtier\src\test\Resources\com\unionstreet\NxTier\smokePack "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.4\lib\idea_rt.jar=52489:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_161\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\rt.jar;C:\Users\rajeshg\IdeaProjects\nxtier\target\test-classes;C:\Users\rajeshg\IdeaProjects\nxtier\target\classes;C:\Users\rajeshg\.m2\repository\com\google\guava\guava\23.0\guava-23.0.jar;C:\Users\rajeshg\.m2\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;C:\Users\rajeshg\.m2\repository\com\google\errorprone\error_prone_annotations\2.0.18\error_prone_annotations-2.0.18.jar;C:\Users\rajeshg\.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;C:\Users\rajeshg\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.14\animal-sniffer-annotations-1.14.jar;C:\Users\rajeshg\.m2\repository\com\jayway\restassured\rest-assured\2.9.0\rest-assured-2.9.0.jar;C:\Users\rajeshg\.m2\repository\org\codehaus\groovy\groovy\2.4.4\groovy-2.4.4.jar;C:\Users\rajeshg\.m2\repository\org\codehaus\groovy\groovy-xml\2.4.4\groovy-xml-2.4.4.jar;C:\Users\rajeshg\.m2\repository\org\apache\httpcomponents\httpclient\4.5.1\httpclient-4.5.1.jar;C:\Users\rajeshg\.m2\repository\org\apache\httpcomponents\httpmime\4.5.1\httpmime-4.5.1.jar;C:\Users\rajeshg\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\rajeshg\.m2\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;C:\Users\rajeshg\.m2\repository\org\ccil\cowan\tagsoup\tagsoup\1.2.1\tagsoup-1.2.1.jar;C:\Users\rajeshg\.m2\repository\com\jayway\restassured\json-path\2.9.0\json-path-2.9.0.jar;C:\Users\rajeshg\.m2\repository\org\codehaus\groovy\groovy-json\2.4.4\groovy-json-2.4.4.jar;C:\Users\rajeshg\.m2\repository\com\jayway\restassured\rest-assured-common\2.9.0\rest-assured-common-2.9.0.jar;C:\Users\rajeshg\.m2\repository\com\jayway\restassured\xml-path\2.9.0\xml-path-2.9.0.jar;C:\Users\rajeshg\.m2\repository\com\jayway\jsonpath\json-path\2.4.0\json-path-2.4.0.jar;C:\Users\rajeshg\.m2\repository\net\minidev\json-smart\2.3\json-smart-2.3.jar;C:\Users\rajeshg\.m2\repository\net\minidev\accessors-smart\1.2\accessors-smart-1.2.jar;C:\Users\rajeshg\.m2\repository\org\ow2\asm\asm\5.0.4\asm-5.0.4.jar;C:\Users\rajeshg\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\rajeshg\.m2\repository\org\hamcrest\hamcrest-all\1.3\hamcrest-all-1.3.jar;C:\Users\rajeshg\.m2\repository\com\googlecode\json-simple\json-simple\1.1.1\json-simple-1.1.1.jar;C:\Users\rajeshg\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\rajeshg\.m2\repository\io\github\bonigarcia\webdrivermanager\2.2.0\webdrivermanager-2.2.0.jar;C:\Users\rajeshg\.m2\repository\commons-io\commons-io\2.5\commons-io-2.5.jar;C:\Users\rajeshg\.m2\repository\com\google\code\gson\gson\2.8.0\gson-2.8.0.jar;C:\Users\rajeshg\.m2\repository\org\rauschig\jarchivelib\0.7.1\jarchivelib-0.7.1.jar;C:\Users\rajeshg\.m2\repository\org\apache\commons\commons-compress\1.9\commons-compress-1.9.jar;C:\Users\rajeshg\.m2\repository\org\jsoup\jsoup\1.10.2\jsoup-1.10.2.jar;C:\Users\rajeshg\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\rajeshg\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\rajeshg\.m2\repository\com\vimalselvam\cucumber-extentsreport\1.0.0\cucumber-extentsreport-1.0.0.jar;C:\Users\rajeshg\.m2\repository\info\cukes\cucumber-java\1.2.3\cucumber-java-1.2.3.jar;C:\Users\rajeshg\.m2\repository\com\relevantcodes\extentreports\2.40.2\extentreports-2.40.2.jar;C:\Users\rajeshg\.m2\repository\org\xerial\sqlite-jdbc\3.8.11.1\sqlite-jdbc-3.8.11.1.jar;C:\Users\rajeshg\.m2\repository\org\freemarker\freemarker\2.3.23\freemarker-2.3.23.jar;C:\Users\rajeshg\.m2\repository\org\apache\directory\studio\org.apache.commons.codec\1.8\org.apache.commons.codec-1.8.jar;C:\Users\rajeshg\.m2\repository\org\seleniumhq\selenium\selenium-java\3.14.0\selenium-java-3.14.0.jar;C:\Users\rajeshg\.m2\repository\org\seleniumhq\selenium\selenium-chrome-driver\3.14.0\selenium-chrome-driver-3.14.0.jar;C:\Users\rajeshg\.m2\repository\org\seleniumhq\selenium\selenium-edge-driver\3.14.0\selenium-edge-driver-3.14.0.jar;C:\Users\rajeshg\.m2\repository\org\seleniumhq\selenium\selenium-firefox-driver\3.14.0\selenium-firefox-driver-3.14.0.jar;C:\Users\rajeshg\.m2\repository\org\seleniumhq\selenium\selenium-ie-driver\3.14.0\selenium-ie-driver-3.14.0.jar;C:\Users\rajeshg\.m2\repository\org\seleniumhq\selenium\selenium-opera-driver\3.14.0\selenium-opera-driver-3.14.0.jar;C:\Users\rajeshg\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\3.14.0\selenium-remote-driver-3.14.0.jar;C:\Users\rajeshg\.m2\repository\org\seleniumhq\selenium\selenium-safari-driver\3.14.0\selenium-safari-driver-3.14.0.jar;C:\Users\rajeshg\.m2\repository\org\seleniumhq\selenium\selenium-support\3.14.0\selenium-support-3.14.0.jar;C:\Users\rajeshg\.m2\repository\net\bytebuddy\byte-buddy\1.8.15\byte-buddy-1.8.15.jar;C:\Users\rajeshg\.m2\repository\org\apache\commons\commons-exec\1.3\commons-exec-1.3.jar;C:\Users\rajeshg\.m2\repository\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;C:\Users\rajeshg\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\rajeshg\.m2\repository\org\apache\httpcomponents\httpcore\4.4.9\httpcore-4.4.9.jar;C:\Users\rajeshg\.m2\repository\com\squareup\okhttp3\okhttp\3.10.0\okhttp-3.10.0.jar;C:\Users\rajeshg\.m2\repository\com\squareup\okio\okio\1.14.1\okio-1.14.1.jar;C:\Users\rajeshg\.m2\repository\org\apache\commons\commons-lang3\3.4\commons-lang3-3.4.jar;C:\Users\rajeshg\.m2\repository\net\sourceforge\htmlunit\htmlunit\2.18\htmlunit-2.18.jar;C:\Users\rajeshg\.m2\repository\xalan\xalan\2.7.2\xalan-2.7.2.jar;C:\Users\rajeshg\.m2\repository\xalan\serializer\2.7.2\serializer-2.7.2.jar;C:\Users\rajeshg\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar;C:\Users\rajeshg\.m2\repository\net\sourceforge\htmlunit\htmlunit-core-js\2.17\htmlunit-core-js-2.17.jar;C:\Users\rajeshg\.m2\repository\xerces\xercesImpl\2.11.0\xercesImpl-2.11.0.jar;C:\Users\rajeshg\.m2\repository\xml-apis\xml-apis\1.4.01\xml-apis-1.4.01.jar;C:\Users\rajeshg\.m2\repository\net\sourceforge\nekohtml\nekohtml\1.9.22\nekohtml-1.9.22.jar;C:\Users\rajeshg\.m2\repository\net\sourceforge\cssparser\cssparser\0.9.16\cssparser-0.9.16.jar;C:\Users\rajeshg\.m2\repository\org\w3c\css\sac\1.3\sac-1.3.jar;C:\Users\rajeshg\.m2\repository\org\eclipse\jetty\websocket\websocket-client\9.2.12.v20150709\websocket-client-9.2.12.v20150709.jar;C:\Users\rajeshg\.m2\repository\org\eclipse\jetty\jetty-util\9.2.12.v20150709\jetty-util-9.2.12.v20150709.jar;C:\Users\rajeshg\.m2\repository\org\eclipse\jetty\jetty-io\9.2.12.v20150709\jetty-io-9.2.12.v20150709.jar;C:\Users\rajeshg\.m2\repository\org\eclipse\jetty\websocket\websocket-common\9.2.12.v20150709\websocket-common-9.2.12.v20150709.jar;C:\Users\rajeshg\.m2\repository\org\eclipse\jetty\websocket\websocket-api\9.2.12.v20150709\websocket-api-9.2.12.v20150709.jar;C:\Users\rajeshg\.m2\repository\net\sourceforge\jtds\jtds\1.3.1\jtds-1.3.1.jar;C:\Users\rajeshg\.m2\repository\xmlunit\xmlunit\1.6\xmlunit-1.6.jar;C:\Users\rajeshg\.m2\repository\com\microsoft\sqlserver\mssql-jdbc\6.1.0.jre8\mssql-jdbc-6.1.0.jre8.jar;C:\Users\rajeshg\.m2\repository\com\microsoft\azure\azure-keyvault\0.9.3\azure-keyvault-0.9.3.jar;C:\Users\rajeshg\.m2\repository\com\microsoft\azure\azure-core\0.9.3\azure-core-0.9.3.jar;C:\Users\rajeshg\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\rajeshg\.m2\repository\javax\mail\mail\1.4.5\mail-1.4.5.jar;C:\Users\rajeshg\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar;C:\Users\rajeshg\.m2\repository\com\sun\jersey\jersey-client\1.13\jersey-client-1.13.jar;C:\Users\rajeshg\.m2\repository\com\sun\jersey\jersey-core\1.13\jersey-core-1.13.jar;C:\Users\rajeshg\.m2\repository\com\sun\jersey\jersey-json\1.13\jersey-json-1.13.jar;C:\Users\rajeshg\.m2\repository\org\codehaus\jettison\jettison\1.1\jettison-1.1.jar;C:\Users\rajeshg\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.3-1\jaxb-impl-2.2.3-1.jar;C:\Users\rajeshg\.m2\repository\javax\xml\bind\jaxb-api\2.2.2\jaxb-api-2.2.2.jar;C:\Users\rajeshg\.m2\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;C:\Users\rajeshg\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.9.2\jackson-core-asl-1.9.2.jar;C:\Users\rajeshg\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.2\jackson-mapper-asl-1.9.2.jar;C:\Users\rajeshg\.m2\repository\org\codehaus\jackson\jackson-jaxrs\1.9.2\jackson-jaxrs-1.9.2.jar;C:\Users\rajeshg\.m2\repository\org\codehaus\jackson\jackson-xc\1.9.2\jackson-xc-1.9.2.jar;C:\Users\rajeshg\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;C:\Users\rajeshg\.m2\repository\com\microsoft\azure\adal4j\1.0.0\adal4j-1.0.0.jar;C:\Users\rajeshg\.m2\repository\com\nimbusds\oauth2-oidc-sdk\4.5\oauth2-oidc-sdk-4.5.jar;C:\Users\rajeshg\.m2\repository\net\jcip\jcip-annotations\1.0\jcip-annotations-1.0.jar;C:\Users\rajeshg\.m2\repository\com\nimbusds\lang-tag\1.4\lang-tag-1.4.jar;C:\Users\rajeshg\.m2\repository\com\nimbusds\nimbus-jose-jwt\3.1.2\nimbus-jose-jwt-3.1.2.jar;C:\Users\rajeshg\.m2\repository\org\bouncycastle\bcprov-jdk15on\1.51\bcprov-jdk15on-1.51.jar;C:\Users\rajeshg\.m2\repository\info\cukes\cucumber-junit\1.2.5\cucumber-junit-1.2.5.jar;C:\Users\rajeshg\.m2\repository\info\cukes\cucumber-core\1.2.5\cucumber-core-1.2.5.jar;C:\Users\rajeshg\.m2\repository\info\cukes\cucumber-html\0.2.3\cucumber-html-0.2.3.jar;C:\Users\rajeshg\.m2\repository\info\cukes\cucumber-jvm-deps\1.0.5\cucumber-jvm-deps-1.0.5.jar;C:\Users\rajeshg\.m2\repository\info\cukes\gherkin\2.12.2\gherkin-2.12.2.jar;C:\Users\rajeshg\.m2\repository\org\apache\pdfbox\pdfbox\2.0.0\pdfbox-2.0.0.jar;C:\Users\rajeshg\.m2\repository\org\apache\pdfbox\fontbox\2.0.0\fontbox-2.0.0.jar;C:\Users\rajeshg\.m2\repository\mysql\mysql-connector-java\6.0.4\mysql-connector-java-6.0.4.jar;C:\Users\rajeshg\.m2\repository\de\redsix\pdfcompare\1.1.25\pdfcompare-1.1.25.jar;C:\Users\rajeshg\.m2\repository\com\typesafe\config\1.3.1\config-1.3.1.jar;C:\Users\rajeshg\.m2\repository\org\dbunit\dbunit\2.5.4\dbunit-2.5.4.jar;C:\Users\rajeshg\.m2\repository\org\apache\poi\poi-ooxml\3.14\poi-ooxml-3.14.jar;C:\Users\rajeshg\.m2\repository\org\apache\poi\poi\3.14\poi-3.14.jar;C:\Users\rajeshg\.m2\repository\org\apache\poi\poi-ooxml-schemas\3.14\poi-ooxml-schemas-3.14.jar;C:\Users\rajeshg\.m2\repository\org\apache\xmlbeans\xmlbeans\2.6.0\xmlbeans-2.6.0.jar;C:\Users\rajeshg\.m2\repository\stax\stax-api\1.0.1\stax-api-1.0.1.jar;C:\Users\rajeshg\.m2\repository\com\github\virtuald\curvesapi\1.03\curvesapi-1.03.jar;C:\Users\rajeshg\.m2\repository\com\opencsv\opencsv\4.0\opencsv-4.0.jar;C:\Users\rajeshg\.m2\repository\org\apache\commons\commons-text\1.1\commons-text-1.1.jar;C:\Users\rajeshg\.m2\repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;C:\Users\rajeshg\.m2\repository\org\seleniumhq\selenium\selenium-api\3.14.0\selenium-api-3.14.0.jar;C:\Users\rajeshg\.m2\repository\io\netty\netty\3.5.7.Final\netty-3.5.7.Final.jar;C:\Users\rajeshg\.IdeaIC2017.3\config\plugins\cucumber-java\lib\cucumber-jvm-formatter.jar" cucumber.api.cli.Main --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --name "^Adding pricing details to a newly created customer$" --glue com.unionstreet.support --glue com.unionstreet.NxTier.stepDefs.smokePack C:/Users/rajeshg/IdeaProjects/nxtier/src/test/Resources/com/unionstreet/NxTier/smokePack/NxTier_smokePack.feature
16:03:51.767 [main] INFO io.github.bonigarcia.wdm.WebDriverManager - Reading https://api.github.com/repos/mozilla/geckodriver/releases to seek wires, geckodriver
16:03:52.126 [main] INFO io.github.bonigarcia.wdm.WebDriverManager - Latest version of wires, geckodriver is 0.21.0
16:03:52.157 [main] INFO io.github.bonigarcia.wdm.Downloader - Using binary driver previously downloaded C:\Users\rajeshg\.m2\repository\webdriver\geckodriver\win64\0.21.0\geckodriver.exe
16:03:52.157 [main] DEBUG io.github.bonigarcia.wdm.Downloader - Target folder content: geckodriver.exe
16:03:52.157 [main] INFO io.github.bonigarcia.wdm.Downloader - Using binary driver previously downloaded C:\Users\rajeshg\.m2\repository\webdriver\geckodriver\win64\0.21.0\geckodriver.exe
16:03:52.157 [main] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.gecko.driver as C:\Users\rajeshg\.m2\repository\webdriver\geckodriver\win64\0.21.0\geckodriver.exe
1533827032298 geckodriver INFO geckodriver 0.21.0
1533827032314 geckodriver INFO Listening on 127.0.0.1:27819
1533827032954 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\rajeshg\\AppData\\Local\\Temp\\rust_mozprofile.DpjbO1o8RyAk"
Unable to read VR Path Registry from C:\Users\rajeshg\AppData\Local\openvr\openvrpaths.vrpath
Unable to read VR Path Registry from C:\Users\rajeshg\AppData\Local\openvr\openvrpaths.vrpath
Unable to read VR Path Registry from C:\Users\rajeshg\AppData\Local\openvr\openvrpaths.vrpath
Unable to read VR Path Registry from C:\Users\rajeshg\AppData\Local\openvr\openvrpaths.vrpath
Unable to read VR Path Registry from C:\Users\rajeshg\AppData\Local\openvr\openvrpaths.vrpath
1533827034578 Marionette INFO Listening on port 52497
1533827034618 Marionette WARN TLS certificate errors will be ignored for this session
Aug 09, 2018 4:03:54 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: By.id: DCompany_name (tried for 20 second(s) with 500 milliseconds interval)
at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:113)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:283)
at com.unionstreet.support.ElementUtils.sendText(ElementUtils.java:70)
at com.unionstreet.com.unionstreet.NxTier.pages.NewBusinessCustomerPage.addCompanyInfoForNewBusinessCustomerCreatedWithDefaultContactTypes(NewBusinessCustomerPage.java:65)
at com.unionstreet.NxTier.stepDefs.smokePack.NxTier_smokePack_stepDefs.iHaveAddedANewBusinessCustomer(NxTier_smokePack_stepDefs.java:79)
at ✽.And I have added a new business customer(C:/Users/rajeshg/IdeaProjects/nxtier/src/test/Resources/com/unionstreet/NxTier/smokePack/NxTier_smokePack.feature:45)
Caused by: org.openqa.selenium.NoSuchElementException: Cannot locate an element using By.id: DCompany_name
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'TESTING001', ip: '10.1.8.93', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161'
Driver info: driver.version: unknown
any help would be much appreciated!
thank you!
1) First you need to retrieve opened tabs
List<String> tabs = new ArrayList<>(driver.getWindowHandles());
2) open new tab
((JavascriptExecutor)driver).executeScript("window.open('/')");
3) navigate to the tab
driver.switchTo.window(tabs.get(index))
100% working solution:
// open new tab
WebDriver driver = DriverFactory.getWebDriver();
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("window.open()");
Thread.sleep(100); // wait to winHandles value increases. Without it will result in random nullPointerException at this point.
// go to tab with index i
WebDriver driver = DriverFactory.getWebDriver();
ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
driver.switchTo().window(tabs.get(i));
Thread.sleep(100);
// close tab
WebDriver driver = DriverFactory.getWebDriver();
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("window.close()");
Thread.sleep(100);

Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

I am trying to run a simple program using Selenium Grid(have no prior knowledge of selenium grid), and I am having error shown as below:
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'DEL1-LTC1X3PH2', ip: '192.168.0.101', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171'
Driver info: driver.version: RemoteWebDriver
Below is my sample code:
String URL = "http://www.DemoQA.com";
String Node = "http://192.168.1.164:4444/wd/hub";
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setBrowserName("firefox");
//cap.setPlatform(Platform.WIN10);
driver = new RemoteWebDriver(new URL(Node), cap);
driver.navigate().to(URL);
Thread.sleep(5000);
driver.quit();
Can someone please explain why this error is coming, and any reference from where I can get to know more about selenium grid.
This error looks like it's occurring because you don't have a Selenium Grid running with a hub at the URL you provided. You need to start the grid yourself, Selenium won't start it for you the way it will start up a single session. You can use docker and docker-compose to start your grid using the instructions here.
You can find more information about Selenium Grid here.
Also, rather than use
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setBrowserName("firefox");
you can condense to one line and use
DesiredCapabilities cap = DesiredCapabilities.firefox();
to set up your DesiredCapabilities.

Capabilities error after using selenium grid and Webdriver manager

I have been using [webdriver manager][1] for local executions, it has been outstanding, however right now I'm trying to use a selenium grid and I would like to use the same approach but I'm getting some errors related to capabilities.
The hub and node are localhost, these are the details of my implementation:
I'm starting the hub with this line:
start cmd /k java -jar selenium-server-standalone-3.5.0.jar -role hub -port 4443
I'm starting the node with this line
start cmd /k java -jar selenium-server-standalone-3.5.0.jar -port 5556 -role node -hub http://localhost:4443/grid/register
This is the configuration that I'm using for the browsers, the problem is with chrome, I haven't tested the other ones yet.
public WebDriver cbt(String browser, String methodName) throws Exception{
WebDriver driver;
DesiredCapabilities caps;
//Check if parameter passed from TestNG is 'firefox'
if(browser.equalsIgnoreCase("firefox"))
{
caps = DesiredCapabilities.firefox();
caps.setCapability("platform", "Windows 10");
caps.setCapability("version", "53.0");
caps.setCapability("name", methodName);
}
//Check if parameter passed as 'chrome'
else if(browser.equalsIgnoreCase("chrome"))
{
caps = DesiredCapabilities.chrome();
}
else if(browser.equalsIgnoreCase("ie")){
caps = DesiredCapabilities.edge();
caps.setCapability("platform", "Windows 10");
caps.setCapability("version", "14.14393");
caps.setCapability("name", methodName);
}
else{
//If no browser passed throw exception
throw new Exception("Browser is not correct");
}
String hub = "http://localhost:4443/wd/hub";
driver = new RemoteWebDriver(new URL(hub), caps);
return driver;
}
These are the errors that I'm getting
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{browserName=chrome, version=, platform=ANY}], required capabilities = Capabilities [{}]
Build info: version: '3.3.1', revision: '5234b325d5', time: '2017-03-10 09:10:29 +0000'
System info: host: 'NEYMAR', ip: '169.254.112.118', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_45'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:158)
at com.gnow.gnow.Utils.CommonConfiguration.cbt(CommonConfiguration.java:213)
at com.gnow.gnow.Test.Test.setUp(Test.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:217)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:590)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:756)
at org.testng.TestRunner.run(TestRunner.java:610)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
at org.testng.TestNG.runSuites(TestNG.java:1133)
at org.testng.TestNG.run(TestNG.java:1104)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
Thanks in advance
[1]: https://github.com/bonigarcia/webdrivermanager
First thing i would suggest is that you upgrade your selenium version to Selenium 3.5.1
There was a bug in Selenium 3.3.1 wherein the actual error wouldn't be passed on to the end-user, and your stacktrace seems to suggest that it's perhaps due to that bug is why you aren't able to see the real problem. This bug was fixed in 3.4.0
Once you upgrade to Selenium 3.5.1 in your client side, you should immediately see the problem.
Since you mentioned Chrome, am guessing that it is perhaps due to the fact that your chromedriver is not available in the PATH.
You might want to take a look at this tutorial I wrote up on Grid, which tells you the set of things that is required to get the Grid up and running. I have included a lot of other information about the Grid as well in there.

Unable to create new remote session while testing an Android application with Appium

I'm trying to run an Example of test scripts coded with java in Eclipse with Appium. I run Appium by npm (i'm using Appium 1.6.3, i'm not new to Appium i run it before on Mac and on windows without any problem but this time in Ubuntu it looks a bit different while it's not with the appium application but with console)
appium --address 127.0.0.1
I'm using
java-client-4.1.2.jar
selenium-java-3.0.1.jar
selenium-server-standalone-3.0.1.jar
testng-6.9.10.jar
And my java class is :
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class FirstTest {
AndroidDriver<AndroidElement> driver;
File path = new File("/home/emna/Téléchargements/AutomationFiles/app-release.apk");
#BeforeClass
public void setUp() throws MalformedURLException {
System.out.println("app Dir.--->" + path);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "SM-G360H");
capabilities.setCapability("version", "4.4.4");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "platform");
capabilities.setCapability("udid", "***************");
capabilities.setCapability("app", path.getAbsolutePath());
capabilities.setCapability("appPackage", "com.bulldozer.gaa");
capabilities.setCapability("appActivity",
"com.bulldozer.gaa.activities.MainActivity");
driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"),
capabilities);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
}
#Test
public void Test1() throws InterruptedException {
// driver.wait(10000);
System.out.println("GAA");
driver.findElement(By.id("acceptCheckbox")).click();
driver.findElement(By.id("continueBtn")).click();
}
#AfterClass
public void tearDown() {
driver.quit();
}
}
But the problem is that :
[TestNG] Running:
/tmp/testng-eclipse--2049046107/testng-customsuite.xml
app Dir.--->/home/emna/Téléchargements/AutomationFiles/app-release.apk
Jan 24, 2017 1:14:44 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Jan 24, 2017 1:14:59 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
Jan 24, 2017 1:15:10 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to straight W3C remote end connection
FAILED CONFIGURATION: #BeforeClass setUp
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{app=/home/emna/Téléchargements/AutomationFiles/app-release.apk, appPackage=com.bulldozer.gaa, appActivity=com.bulldozer.gaa.activities.MainActivity, platformVersion=platform, platformName=Android, udid=*************, deviceName=SM-G360H, version=4.4.4}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'tarek-Vostro-3902', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-59-generic', java.version: '1.8.0_91'
Driver info: driver.version: AndroidDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
Here the Appium log file :
[debug] [ADB] Running '/home/emna/Android/Sdk/platform-tools/adb' with args: ["-P",5037,"-s","***************","shell","am","force-stop","io.appium.unlock"]
[debug] [Logcat] Stopping logcat capture
[debug] [AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[MJSONWP] Encountered internal error running command: Error: Error occured while starting App. Original error: Permission to start activity denied.
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at ADB.callee$0$0$ (../../../lib/tools/apk-utils.js:80:9)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
[HTTP] <-- POST /wd/hub/session 500 11015 ms - 223
[HTTP] --> POST /wd/hub/session {"capabilities":{"desiredCapabilities":{"app":"/home/emna/Téléchargements/AutomationFiles/app-release.apk","appPackage":"com.bulldozer.gaa","appActivity":"com.bulldozer.gaa.activities.MainActivity","platformVersion":"platform","platformName":"Android","udid":"************","deviceName":"SM-G360H","version":"4.4.4"},"requiredCapabilities":{}}}
[debug] [MJSONWP] Bad parameters: BadParametersError: Parameters were incorrect. We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities","capabilities","sessionId","id","sessionId","id","sessionId","id"]} and you sent ["capabilities"]
[HTTP] <-- POST /wd/hub/session 400 5 ms - 205
You forgot the most important capability, which is the path to the .apk:
capabilities.setCapability("app", "appPath");
Also, i would recommend on changing from RemoteWebDriver to Android driver, since you will have some more functionality:
driver = new AndroidDriver(....)
ps: you can update your java-client to 4.1.2 and testng to 6.9.10
The reason is because your Appium is running already the app using GUI settings.
Simultaneously you are trying to run it again from your code.
What should help : In Appium UI go to Android settings (basic)
Application panel: do not define / launch the app and its activities.
Capabilities panel: define and select {Platform Name, Automation Name, Platform Version}
The problem is with the apk file itself, I used an other .apk file with the same configuration i have used and it works fine !
This could be an issue, since as I understood you are running Appium on the same machine where your client scripts reside, try using "http://127.0.1.1:4723/wd/hub" instead. this Solution works for me
AndroidDriver<AndroidElement> driver = null;
driver = new AndroidDriver<>(new URL("http://127.0.1.1:4723/wd/hub"), capabilities);

Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException:Could not start a new session

I just started to learn Selenium WebDriver. Could you all help me to resolve below problem.
I simply want to open the web-site(I am able to open browser successfully but navigation got failed )
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
public class webdriverdemo {
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver driver = new FirefoxDriver();
//Puts an Implicit wait, Will wait for 10 seconds before throwing exception
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
//Launch website
driver.navigate().to("http://www.calculator.net/");
//Maximize the browser
driver.manage().window().maximize();
}
}
I found below errors :
Exception in thread "main"
org.openqa.selenium.remote.UnreachableBrowserException: Could not
start a new session. Possible causes are invalid address of the remote
server or browser start-up failure.
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'WIN-EHSO6G1D9KD', ip: '192.168.13.2', os.name: 'Windows Server 2012', os.arch: 'amd64', os.version: '6.2',
java.version: '1.8.0_91'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:665)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:120)
at webdriverdemo.main(webdriverdemo.java:13)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:139)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:155)
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:284)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:144)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:90)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:160)
at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:380)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
... 7 more
Firefox version 47.0.6
Platform Win2k12 r2
Seems like there is some issue with creating session with Firefox.
Try the following code and test using Chrome browser.
You need to download the executable driver from: https://sites.google.com/a/chromium.org/chromedriver/downloads
public static void main(String[] args){
System.setProperty("webdriver.chrome.driver","/path/to/chromedriver");
WebDriver driver = new ChromeDriver();
driver = new ChromeDriver();
//Puts an Implicit wait, Will wait for 10 seconds before throwing exception
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
//Launch website
driver.get("http://www.calculator.net/");
//Maximize the browser
driver.manage().window().maximize();
}

Resources