i am running selenium for chrome and need to open google page. i am using testng and i have my chrome driver in the path \src\test\resources. i use jdk 1.8 and windows 64
i use the below code and i am not able to load successsfully
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("chromedriver-2.27.exe").getFile());
String path=file.getAbsolutePath();
System.setProperty("webdriver.chrome.driver",path);
WebDriver driver = new ChromeDriver();
driver.get("www.google.com");
i get error
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.3.1', revision: '5234b325d5', time: '2017-03-10 09:10:29 +0000'
System info: host: 'NANSARI', ip: '172.18.240.141', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: driver.version: ChromeDriver
Please advise.
Try it this way and see if it works -
Put the ChromeDriver outside the project directory, say - C:\Selenium_Drivers
Code -
System.setProperty("webdriver.chrome.driver","C:\\Selenium_Drivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("www.google.com");
Please use the latest version of Selenium, ChromeDriver and Chrome
Related
I need to launch Microsoft edge browser through selenium grid, but whenever I try to launch the browser below error thrown and browser is not initiated
org.openqa.selenium.SessionNotCreatedException: Unable to create new service: EdgeDriverService Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:19.891Z' System info: host: 'ERD-L046', ip: '192.168.2.46', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_131' Driver info: driver.version: unknown Command duration or timeout: 74 milliseconds
To configure a grid set up I have used the below code :
To set up HUB :
java -jar selenium-server-standalone-3.13.0.jar -role hub
To set up Node :
java -Dwebdriver.edge.driver="D:/Softwares/Selenium/IEDriver/MicrosoftWebDriver.exe" -jar selenium-server-standalone-3.13.0.jar -port 5567 -role node -hub http://192.168.2.46:4444/grid/register -browser "browserName=MicrosoftEdge, maxInstances=5"
To launch the browser I have used the below code :
EdgeOptions options = new EdgeOptions();
options.setCapability("platform", "Any");
options.setCapability("browserName", "MicrosoftEdge");
options.setCapability("ignoreZoomSetting", true);
options.setCapability("browserVersion", "41.16299.15.0");
System.setProperty("webdriver.edge.driver", "D:/Softwares/Selenium/Drivers/IEDriver/MicrosoftWebDriver.exe");
driver = new RemoteWebDriver(new URL("http://192.168.2.46:5567/wd/hub"), options);
OS : Windows 10 pro [version 1709 16299.125]
Browser version : 41.16299.15.0
Selenium Version : 3.13.0
Selenium server standalone : 3.13.0
Microsoft WebDriver version : Release 16299 | Version: 5.16299 | Edge version supported: 16.16299
Kindly someone shed light on this.
Please recheck on Driver calling path calling, In mentioned path it includes folder IEDriver. Also you can check with forward double slash.
I am trying to upgrade my project from Selenium 3.0.0beta4 to 3.6.0. I want to set the timeout for page loading with
driver.manage().timeouts().pageLoadTimeout(90, TimeUnit.SECONDS);
This, however, crashes the application:
Exception in thread "main" org.openqa.selenium.InvalidArgumentException:
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:26.402Z'
System info: host: 'machine.example.org', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.88', java.version: '1.8.0_144'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=/tmp/rust_mozprofile.AZHGaB47hL8x, rotatable=false, timeouts={implicit=0, page load=300000, script=30000}, pageLoadStrategy=normal, platform=LINUX, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=52.4.0, platformVersion=4.4.88, moz:processID=10959, browserName=firefox, javascriptEnabled=true, platformName=LINUX}]
The value is not changed. I am using geckodriver v0.18.0 and Firefox 52.4.0.
Is there any limitation on the Firefox version I can use?
In the Selenium 3.0.0beta4 version of my application I set the following property for the gecko driver:
System.setProperty("webdriver.gecko.driver", "/path/to/geckodriver");
After I changed the property to
System.setProperty("webdriver.firefox.marionette", "/path/to/geckodriver");
in the Selenium 3.6.0 version my application started working again. I use Firefox v45.9.0 and geckodriver v0.18.0. Other combinations may work, too.
I have set up an ANT project to write my UI automation framework using Selenium 3.4.0. I am using Gecko driver v18.0 for supporting latest FF browser v55.
java version I am using is 1.8. This project initializes the FF browser with "desired capabilities" object and completes the test. IDE used for this project is Eclipse (Enide 2015). The unit testing framework here is TestNG.
I tried to replicate the same in a maven project using 3.4.0 selenium & Gecko driver v18.0. IDE I am using is IntelliJ. But here after the code executes the driver-initialize part, the browser window opens and then the control never comes back to selenium. The browser remains open for 10-15 min & process keeps running in the background. I have to stop the run to come out of it. Unit testing framework for Maven project here JBehave.
So I did few hit and trails to see the compatibility between Selenium and Gecko driver for Firefox:
Selenium 3.4.0 | Firefox v55 | Gecko Driver version - v15 for 32/64 bit |
Result:
After Initializing FF browser, control does not return back to Selenium.
Selenium 3.4.0 | Firefox v55 | Gecko Driver version - v16 for 32/64 bit |
Result:
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=false, logLevel=null, prefs={}, profile=null}}], required capabilities = Capabilities [{}]
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'XXXXX', ip: 'xxx.xxx.xx.xx', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: driver.version: FirefoxDriver
Selenium 3.5.1 | Firefox v55 | Gecko Driver version - v15-v19 for 32/64 bit |
Result:
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=false, logLevel=null, prefs={}, profile=null}}], required capabilities = Capabilities [{}]
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'XXXXX', ip: 'xxx.xxx.xx.xx', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: driver.version: FirefoxDriver
Selenium 2.53.1 | Firefox v55 | Gecko Driver version - v15 for 32/64 bit |
Result:
WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055
Selenium 2.53.1 | Chrome |
Result:
Test code executed successfully.
Selenium 3.5.1 | Firefox v54 | Gecko Driver version - v16 for 32/64 bit |
Result:
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=false, logLevel=null, prefs={}, profile=null}}], required capabilities = Capabilities [{}]
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'XXXXX', ip: 'xxx.xxx.xx.xx', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: driver.version: FirefoxDriver
I have read through most links mentioned below but it did not help-
Selenium 3.4.0 with Firefox 55
https://seleniumhq.wordpress.com/2017/08/09/firefox-55-and-selenium-ide/
Selenium 3.0 Firefx Driver fails with org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session
Unable to create new remote session - Selenium webdriver
https://github.com/mozilla/geckodriver/issues/749
https://github.com/SeleniumHQ/selenium/issues/3630
For the first entry above (...which is Selenium 3.4.0, Firefox v55 and Gecko drover v15 for 32/64 bit windows), when I did Ctrl+Shift+J I got the below log-
1505982873005 addons.xpi WARN Error parsing extensions state: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [amIAddonManagerStartup.readStartupData]" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: resource://gre/modules/addons/XPIProvider.jsm :: loadExtensionState :: line 1596" data: no] Stack trace:
loadExtensionState()#resource://gre/modules/addons/XPIProvider.jsm:1596 < getInstallState()#resource://gre/modules/addons/XPIProvider.jsm:1631 < checkForChanges()#resource://gre/modules/addons/XPIProvider.jsm:3152 < startup()#resource://gre/modules/addons/XPIProvider.jsm:2246 < callProvider()#resource://gre/modules/AddonManager.jsm:271 < _startProvider()#resource://gre/modules/AddonManager.jsm:741 < startup()#resource://gre/modules/AddonManager.jsm:908 < startup()#resource://gre/modules/AddonManager.jsm:3122 < observe()#jar:file:///C:/Program%20Files%20(x86)/Mozilla%20Firefox/omni.ja!/components/addonManager.js:65
While creating services from category 'profile-after-change', service for entry 'Notification Telemetry Service', contract ID '#mozilla.org/notificationTelemetryService;1' does not implement nsIObserver.
Warning: unrecognized command line flag --marionette
nsBrowserContentHandler.js:726
PAC file installed from http://autocache.hpecorp.net/
Property contained reference to invalid variable. Error in parsing value for ‘color’. Falling back to ‘inherit’. browser.css:251:7560
DEPRECATION WARNING: Search service falling back to synchronous initialization. This is generally the consequence of an add-on using a deprecated search service API.
My target is to use this framework for UI testing against the latest stable version of IE, Chrome & Firefox browser. Any help in this regard will be helpful.
I am having exactly same issue on MAC osx , I have been looking for solution for a couple of days
508672244107 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-profile" "/var/folders/0k/gv7bgjzs157b0mydntwdqj840000gy/T/rust_mozprofile.hixndTibKloe"
1508672244363 addons.xpi WARN Error parsing extensions state: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [amIAddonManagerStartup.readStartupData]" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: resource://gre/modules/addons/XPIProvider.jsm :: loadExtensionState :: line 1554" data: no] Stack trace: loadExtensionState()#resource://gre/modules/addons/XPIProvider.jsm:1554 < getInstallState()#resource://gre/modules/addons/XPIProvider.jsm:1589 < checkForChanges()#resource://gre/modules/addons/XPIProvider.jsm:3109 < startup()#resource://gre/modules/addons/XPIProvider.jsm:2188 < callProvider()#resource://gre/modules/AddonManager.jsm:269 < _startProvider()#resource://gre/modules/AddonManager.jsm:739 < startup()#resource://gre/modules/AddonManager.jsm:906 < startup()#resource://gre/modules/AddonManager.jsm:3090 < observe()#jar:file:///Applications/Firefox.app/Contents/Resources/omni.ja!/components/addonManager.js:65
1508672244714 Marionette INFO Enabled via --marionette
2017-10-22 14:37:25.560 plugin-container[2720:62009] * CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0xad3f, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2017-10-22 14:37:25.560 plugin-container[2720:62009] * CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x560b, name = 'com.apple.CFPasteboardClient'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2017-10-22 14:37:25.560 plugin-container[2720:62009] void __CFPasteboardSetup() : Failed to allocate communication port for com.apple.CFPasteboardClient; this is likely due to sandbox restrictions
1508672245808 Marionette INFO Listening on port 57372
1508672245923 Marionette DEBUG Register listener.js for window 2147483649
INFO 10/22 11:37:25 o.o.s.r.ProtocolHan~ - Falling back to original OSS JSON Wire Protocol.
INFO 10/22 11:37:25 o.o.s.r.ProtocolHan~ - Falling back to straight W3C remote end connection
22Oct2017 14:37:26,364 [INFO] TestCycle.initializeWebDriver - Error initializining: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions#67c2e933, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions#67c2e933, version=, platform=ANY}], required capabilities = Capabilities [{}]
Build info: version: '3.0.0', revision: '350cf60', time: '2016-10-13 10:48:57 -0700'
System info: host: 'tlv-mpp6a', ip: '172.29.53.33', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
I have some Java scripts for Chrome browser and now I want to run the scripts in htmlUnit. I think the scripts are the same for both, but I got some error when running in htmlUnit? why? So basically which actions (click()? isDisplayed()? etc.) only in Browser test but not in headless tests? and general documents about this difference? Thanks
######### Seems css may have problem here but work OK in Chrome ##############
Exception in thread "main" org.openqa.selenium.NoSuchElementException:
Returned node was not an HTML element For documentation on this error,
please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05
22:01:35' System info: host: 'FGS-CIT-2758', ip: '192.168.200.201',
os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version:
'1.8.0_40' Driver info: driver.version: HtmlUnitDriver at
org.openqa.selenium.htmlunit.HtmlUnitDriver.findElementByCssSelector(HtmlUnitDriver.java:1002)
at org.openqa.selenium.By$ByCssSelector.findElement(By.java:426) at
org.openqa.selenium.htmlunit.HtmlUnitDriver$5.call(HtmlUnitDriver.java:1648)
at
org.openqa.selenium.htmlunit.HtmlUnitDriver$5.call(HtmlUnitDriver.java:1)
at
org.openqa.selenium.htmlunit.HtmlUnitDriver.implicitlyWaitFor(HtmlUnitDriver.java:1302)
at
org.openqa.selenium.htmlunit.HtmlUnitDriver.findElement(HtmlUnitDriver.java:1644)
at
org.openqa.selenium.htmlunit.HtmlUnitDriver.findElement(HtmlUnitDriver.java:550)
at com.ATIP400Suite.CH_ATIP40.mainCheck(CH_ATIP40.java:461) at
com.ATIP400Suite.CH_ATIP40.main(CH_ATIP40.java:58)
Line461 =
driver.findElement(By.cssSelector("span.icon-meter.enlargeIcon")).isDisplayed()
Did you enable javascript in HtmlUnitDriver?
If yes, before click check ExpectedConditions:
presenceOfElementLocated (if you are not sure that an element is present on the DOM)
elementToBeClickable
good luck...
I use windows 8, selenium 2.42 and FF 27.
So i have some trouble.If ff run when i create new driver
WebDriver driver = new FirefoxDriver();
a have exeption
Exception in thread "main" org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms
Build info: version: '2.42.2', revision: '6a6995d31c7c56c340d6f45a76976d43506cd6cc', time: '2014-06-03 10:52:47'
System info: host: 'bot-pc', ip: '25.111.126.28', os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.6.0_45'
i want create 2 or 3 parallel instances FF, but this don't work if ff open.
What you need to use different port numbers for each of the driver instances. Have a look at https://code.google.com/p/selenium/wiki/FirefoxDriver. You can set system property webdriver.firefox.port to make firefox driver use a different port.