How to resolve this issue. Earlier my code was working, but IE settings were reseted by someone. Now I am getting this exception.
Started InternetExplorerDriver server (32-bit)
2.53.1.0
Listening on port 16183
Only local connections are allowed
Oct 21, 2016 10:14:12 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Oct 21, 2016 10:14:12 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to straight W3C remote end connection
Oct 21, 2016 10:14:12 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}], required capabilities = null
Build info: version: 'unknown', revision: '3169782', time: '2016-09-29 10:24:50 -0700'
System info: host: 'BWT12654001', ip: '10.52.132.157', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_101'
Driver info: driver.version: InternetExplorerDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:80)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:228)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:180)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:172)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:144)
at mypackage.TestIEBrowser.main(TestIEBrowser.java:33)
This can work out of the box without the desired capability settings. Go to internet options>>Security, click on:'Reset all zones to default level and after that, ensure that the 'Enable protected mode' checkbox is ticked for all the four zones.
First, check your default zoom level in Internet Explorer. If it's not 100% then do the following steps:
Open Internet Explorer.
Press Alt + X and then click on Internet Options.
Click on the Advanced tab.
Place a check mark on "Reset Zoom level for new Windows and tab"
Press Apply and ok.
Close and open Internet Explorer window and check if the Default Zoom
is set to 100 %.
Once you have done with above steps, add following lines in your code:
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
Now run your program and it should work.
Hope it will help!!
The issue is discussed on Selenium project on Github
Here is the quote of the most relevant/informative part which helped me to solve the issue:
The good news is that it looks like the IE driver mostly works with IE11, provided
that (a) all security zones are set to the same Protected Mode setting and (b) Enhanced
Protected Mode is turned off. Note that the standard registry checks that the IE driver
uses to test for Protected Mode settings in IE7-10 are broken for IE11, and we've never
made any attempt to check for Enhanced Protected Mode, so there's no warning (yet)
if you don't have these settings properly set.
The bad news is that cookie manipulation is broken. Badly. If you attempt to set or
retrieve cookies, there's a chance that you'll end up with the "Unable to get browser"
error encountered before. At the moment, there is no workaround for that.
I had the same issue (in my case Firefox):
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, browserName=firefox, moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}, version=, platform=ANY}], required capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}}]
Using Selenium driver 3.3.1:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.3.1</version>
</dependency>
And solved it via another version like 3.4+.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
Related
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);
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.
Any specific reason why abruptly connection to MSSQL server is lost. I am running web application on the same machine so network connectivity issues are out of question. My application uses Jackrabbit configured to store content with MSSQL. Application is running on Wildfly v9 with JAVA_HOME set to jdk1.8 and I have verified that wildfly is picking it up as well. Also, sqljdbc4-3.0.jar is available to wildfly modules with proper driver configuration in standalone. I am baffled as to why jdk7 adapter would be called to manage connection. However, interesting observation is that this does not occur with Wildfly 10.
standalone.xml
<driver name="sqlserver" module="com.microsoft.sqlserver">
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
</driver>
exception:
ERROR 21-07 16:41:13,636 (DbUtility.java:logException:92) failed to close ResultSet
ERROR 21-07 16:41:13,637 (DbUtility.java:logException:94) Reason: IJ031040: Connection is not associated with a managed connection: org.jboss.jca.adapters.jdbc.jdk7.WrappedConnectionJDK7#386eff84
ERROR 21-07 16:41:13,639 (DbUtility.java:logException:95) State/Code: null/0
I am facing issue while executing the selenium scripts in firefox browser.
Console Error:
org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
System info: host: 'usnywqa01', ip: '10.3.3.20', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_17'
Driver info: driver.version: FirefoxDriver
Build info: version: '2.39.0', revision: '14fa800511cc5d66d426e08b0b2ab926c7ed7398', time: '2013-12-16 13:18:38'
System info: host: abc-PV-5', ip: 'XX.X.XX.XX', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_07'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.internal.SocketLock.lock(SocketLock.java:98)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:84)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:110)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:197)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:190)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:108)
at sun.reflect.GeneratedConstructorAccessor51.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:62)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:56)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:216)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:170)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I tried by changing selenium server to 2.35 or 2.39 and I upgraded ff to 26. But it doesnt work
When I degrade my ff version to 24, my scripts are working fine.
I would like to know why it is happened and root causes
I would like to know what is permanent solution for above 24 version of ff.
Please help me on this.
Seems like an issue with webdriver version. Can you try once with latest bindings i.e 2.40.0. To get more info on webdriver version and supported firefox version please go throgh webdriver release notes :http://selenium.googlecode.com/git/java/CHANGELOG
I had the same message before and I actually found out that the problem was the hosts file in my Mac (/private/etc/hosts). I don't know the reason but somehow it was pointing to an invalid IP in my network. Replacing the line for localhost pointing to 127.0.0.1 solved the problem for me. In resume, I was trying to access the Firefox in some other machine (odd!)
I had the same problem with the same output, i.e:
org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms
I was using Selenium and Java in my project in Eclipse IDE and when I tried to run tests, firefox window opened, but nothing happened later (i.e. it was blank and couldn't catch the URL from my test).
Solution: I changed the version of the driver in my POM.xml file from 2.42.x to 2.43.1. I rebuilt my project and now it works fine.
Now my POM.xml file looks as follows:
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.43.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
Just try out the newest version of selenium driver or try to downgrade firefox (when you download firefox, it automatically downloads its latest version; some people claim that downgrading to older version may help).
Issue seems to be with Firefox latest version does not support web driver.
Was facing similar issue, used chrome driver instaed of Firefox and it worked.
When we download web driver and extract it to a folder, changelog file will be there, open it with notepad, supported Firefox version is mentioned. So we can successfully execute script on mentioned firefox version.
I don't understand how can this be. The error sometimes disappears but mostly it is actual. Selenium logs show the following:
Element not found with xpath, //html
Unable to locate element: {"method":"xpath","selector":"//html"}
Command duration or timeout: 1.24 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-5-686', java.version: '1.7.0_11'
Session ID: cbfc080e-f4a9-4ec9-aa72-3a8adeb0e9b9
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=LINUX, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=17.0}] [] []
Thanks in advance for any help!
UPDATE
I figured out that the problem is only actual for the following versions of the Selenium server:
selenium-server-standalone-2.31.0.jar
selenium-server-standalone-2.32.0.jar
selenium-server-standalone-2.28.0.jar works fine with such XPath locators.
I had the same problem and I have fixed these random errors, with two actions:
I have added the tag #insulated on all my features. It closes the browser for each scenario. You can find most informations on the Behat documentation.
Then, I have added the option --rerun when I execute Behat because I have few random errors on few random scenarios. There are the options in the manual (./behat --help). Quickly, you can execute behat with this option like this : bin/behat [#NamespaceMyBundle[/myFeature.feature]] --rerun .behat_rerun. (bin/behat because I use behat in a Symfony2 project and I launch the command from top directory).
A third option that I don't have implemented but is recommended on Behat doc, is to implement a spin() method which will scan and wait if an element is not available. The blog post is available here.
Two ideas:
Try changing the xpath to /html
Try changing the find method to findElement(By.ByTagName("html"));
If the error is intermittent, is it possibly because webdriver is trying to find the element before the page has loaded? If you stick an appropriate wait in there, does it get rid of the error?