Updated the firefox to version 48 but it give the following error. Any help how to solve it:
Selenium::WebDriver::Error::WebDriverError: unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/firefox/launcher.rb:90:in connect_until_stable'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/firefox/launcher.rb:55:inblock in launch'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/common/socket_lock.rb:43:in locked'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/firefox/launcher.rb:51:inlaunch'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/firefox/bridge.rb:43:in initialize'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/common/driver.rb:53:innew'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/common/driver.rb:53:in for'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver.rb:86:infor'
from /Library/Ruby/Gems/2.0.0/gems/capybara-2.6.2/lib/capybara/selenium/driver.rb:13:in browser'
from /Library/Ruby/Gems/2.0.0/gems/capybara-2.6.2/lib/capybara/selenium/driver.rb:45:invisit'
from /Library/Ruby/Gems/2.0.0/gems/capybara-2.6.2/lib/capybara/session.rb:232:in visit'
from /Library/Ruby/Gems/2.0.0/gems/capybara-2.6.2/lib/capybara/dsl.rb:51:inblock (2 levels) in '
from /Users/mesutgunes/scripts/capybara.rb:53
from /usr/bin/irb:12:in `'
Firefox v48 is not usable (in Capybara) without selenium-webdriver v3 and geckodriver. There is a beta version of selenium-webdriver v3 but it is currently missing a number of critical features (can't read the current value of form element for instance) and isn't really ready for real testing use yet. Downgrade to 47 for now.
Related
I am currently facing a problem with Selenium and findElements(By.xpath()).
Currently I am automating on Salesforce (dynamic IDs and we are using text() so we cannot use CSS selectors) and while my XpathFinder (Chrome AddOn) is able to process the Xpath Selenium throws the following error:
invalid selector: Unable to locate an element with the xpath expression
//div[contains(#class,'windowViewMode-normal')]//div[#class='slds-tabs_default' and not(ancestor::*
[contains(#class,'sidebar')])]//force-record-layout-item//(span[not(contains(#class,'assistive')
or #class='slds-checkbox' or contains(#class,'slds-button') or contains(#class,'test-id__field-
value') or contains(#class,'flex-wrap') or contains(#class,'avatar'))]|a|emailui-formatted-email-
wrapper//div[not(*)]|lightning-formatted-text|lightning-formatted-number[text()]|lightning-
formatted-name|lightning-formatted-phone[not(*)]|lightning-formatted-address[not(*)])
because of the following error:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string
'//div[contains(#class,'windowViewMode-normal')]//div[#class='slds-tabs_default' and
not(ancestor::*[contains(#class,'sidebar')])]//force-record-layout-
item//(span[not(contains(#class,'assistive') or #class='slds-checkbox' or contains(#class,'slds-
button') or contains(#class,'test-id__field-value') or contains(#class,'flex-wrap') or
contains(#class,'avatar'))]|a|emailui-formatted-email-wrapper//div[not(*)]|lightning-formatted-
text|lightning-formatted-number[text()]|lightning-formatted-name|lightning-formatted-
phone[not(*)]|lightning-formatted-address[not(*)])'
is not a valid XPath expression.
(Session info: chrome=79.0.3945.117)
(Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),
platform=Windows NT 10.0.17763 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
The problem is in the grouping after
//div[contains(#class,'windowViewMode-normal')]//div[#class='slds-tabs_default' and not(ancestor::*
[contains(#class,'sidebar')])]//force-record-layout-item//...
If i remove the grouping (the ( before the first span and ) at the end of the xpath) and add that part of the xpath after every | the xpath can be evaluated by both XpathFinder and Selenium.
Is my grouping wrong and the browser is just coincidentlly able to evaluate this or is Selenium buggy while evaluating xpaths?
So to summerize it simply:
If i try to evaluate the following
//div//(a|b)
the evaluation failed with the given error. Is the grouping done wrong or am I missing something else?
EDIT:
After getting ChromeDriver to v79 to match the versions the same error appeared:
invalid selector: Unable to locate an element with the xpath expression
(//div[contains(#class,'windowViewMode-normal')]//div[#class='slds-
tabs_default' and not(ancestor::*[contains(#class,'sidebar')])]//force-record-
layout-item)//(span[not(contains(#class,'assistive') or #class='slds-checkbox'
or contains(#class,'slds-button') or contains(#class,'test-id__field-value') or
contains(#class,'flex-wrap') or contains(#class,'avatar'))]|a|emailui-
formatted-email-wrapper//div[not(*)]|lightning-formatted-text|lightning-
formatted-number[text()]|lightning-formatted-name|lightning-formatted-
phone[not(*)]|lightning-formatted-address[not(*)])
because of the following error:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string
'(//div[contains(#class,'windowViewMode-normal')]//div[#class='slds-
tabs_default' and not(ancestor::*[contains(#class,'sidebar')])]//force-record-
layout-item)//(span[not(contains(#class,'assistive') or #class='slds-checkbox'
or contains(#class,'slds-button') or contains(#class,'test-id__field-value') or
contains(#class,'flex-wrap') or contains(#class,'avatar'))]|a|emailui-
formatted-email-wrapper//div[not(*)]|lightning-formatted-text|lightning-
formatted-number[text()]|lightning-formatted-name|lightning-formatted-
phone[not(*)]|lightning-formatted-address[not(*)])' is not a valid XPath
expression.
(Session info: chrome=79.0.3945.117)
This error message...
invalid selector: Unable to locate an element with the xpath expression
//div[contains(#class,'windowViewMode-normal')]...lightning-formatted-address[not(*)])'
is not a valid XPath expression.
(Session info: chrome=79.0.3945.117)
(Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),
platform=Windows NT 10.0.17763 x86_64) (WARNING: The server did not provide any stacktrace information)
...implies that the ChromeDriver was unable to locate an element due to invalid selector.
If you observe the intermediate <span> tag within the xpath you are using, there seems an extra pair of single quotes present which is causing InvalidSelectorException:
//(span[not(contains(#class,'assistive') or #class='slds-checkbox' or contains(#class,'slds-button') or contains(#class,'test-id__field-value') or contains(#class,'flex-wrap') or contains(#class,'avatar'))]
^starting here
Removing this will solve your issue of invalid selector
However your bigger issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.41
Release Notes of chromedriver=2.41 clearly mentions the following :
Supports Chrome v67-69
You are using chrome=79.0
Release Notes of ChromeDriver v79.0 clearly mentions the following :
Supports Chrome version 79
Your Selenium Client version is unknown to us.
So there is a clear mismatch between the ChromeDriver v2.41 and the Chrome Browser v79.0
Solution
Ensure that:
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v79.0.3945.36 level.
Chrome is updated to current Chrome Version 79.0 level. (as per ChromeDriver v79.0 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
(WindowsOS only) Use CCleaner tool to wipe off all the OS chores before and after the execution of your Test Suite.
(LinuxOS only) Free Up and Release the Unused/Cached Memory in Ubuntu/Linux Mint before and after the execution of your Test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test as non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
I'm stuck trying to get my Selenium script running on my raspberry Pi 4 running with raspbian.
The script is running fine on my mac.
The problem is with setting up the webdriver. I tried installing several webdrivers, including chromedriver, geckodriver, operadriver and phantomjsdriver.
Whenever I'm trying to run the script (which I of course changed to the corresponding drivers) I'm greeted with the following error:
OSError: [Errno 8] Exec format error: 'operadriver'
Also trying to open the driver directly from the shell is resulting in an error:
pi#raspberrypi:/home/shares/users $ chromedriver
bash: /usr/local/bin/chromedriver: cannot execute binary file: Exec format error
My research found some people who got it to work, but all the posts seemed quite old. Some where suggesting the error is pointing to the cpu architecture which is armv7l/armhf in my case.
So is it at all possible to get Selenium running on a pi these days? Has anyone got this to work?
This error message with operadriver...
OSError: [Errno 8] Exec format error: 'operadriver'
and this error message with chromedriver...
ash: /usr/local/bin/chromedriver: cannot execute binary file: Exec format error
...implies that the respective OperaDriver and the ChromeDriver binaries which were invoked was not in proper format.
On your macos system you have used the following WebDriver variants:
GeckoDriver: geckodriver-v0.26.0-macos.tar.gz
ChromeDriver: chromedriver_mac64.tar.gz
where the WebDriver variants matched the underlying os architecture.
Now as you are using armv7 architecture, you have to download and use the relevant format and version of executables downloading it from WebDriver driver for the Chromium Browser
Note: It is to be noted that from geckodriver v0.24.0 onwards:
Removed
Turned off builds for arm7hf, which will no longer be released but can still be built from the source.
References
You can find a couple of relevant discussions in:
OSError: [Errno 8] Exec format error with GeckoDriver and Selenium on MacOS
WebDriverException: Message: Service /usr/lib/chromium-browser/chromedriver unexpectedly exited on Raspberry-Pi with ChromeDriver and Selenium
What is this alphanumeric number "9aea000394714d2fbb20850021f6204f2256b9cf" displayed in the console message after starting chrome driver.
Below is the message:
Starting ChromeDriver 2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9cf) on port 9515
Only local connections are allowed.
Is it SHA-1 checksum, which is displayed after git commit??
The alphanumeric number 9aea000394714d2fbb20850021f6204f2256b9cf in the ChromeDriver starup logs:
Starting ChromeDriver 2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9cf) on port 9515
refers to the commit which is used to build the current version of ChromeDriver.
However, ChromeDriver 2.24.417431 is a pretty old build and you may like to upgrade to the latest ChromeDriver v78.0 level.
Now, using ChromeDriver v78.0.3904.70 the startup log is as follows:
Starting ChromeDriver 78.0.3904.70 (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-heads/3904#{#800}) on port 35520
where edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5 is exactly the commit through which version number was incremented to 78.0.3904.70
Snapshot:
This is the github version id for the chromedriver in use.
The error (s) are
C:\Users\kclarke\workspace\Watir>cucumber features
*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansicon/) to get coloured output on Windows
Starting ChromeDriver (v2.4.226107) on port 9515
[5988:6436:0216/144720:ERROR:gpu_info_collector_win.cc(146)] Could not read gaming score from assessment results.
[5988:6436:0216/144720:ERROR:chrome_views_delegate.cc(176)] NOT IMPLEMENTED
[5988:6436:0216/144720:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED
[2636:7124:0216/144735:ERROR:ipc_channel_win.cc(405)] pipe error: 232
unknown error: Chrome failed to start: exited normally
(Driver info: chromedriver=2.4.226107,platform=Windows NT 6.1 SP1 x86_64) (Selenium::WebDriver::Error::UnknownError)
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/response.rb:51:in `assert_ok'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/http/default.rb:66:in `request'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/bridge.rb:634:in `raw_execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/bridge.rb:99:in `create_session'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
Chrome Driver (version v2.4.226107 ) installed in path: C:\Ruby200\bin;C:\Users\kclarke\workspace\bin
My Code looks like this :
require 'rubygems'
require 'watir-webdriver'
##browser = Watir::Browser.new :firefox
#browser = Watir::Browser.new :chrome
##browser = Watir::Browser.new :ie
#browser.goto 'http:XXXXXXXXXXXXXXXXX'
First, this has nothing to do with wrong PATH, as clearly you can see from the message, ChromeDriver can be started successfully.
Then I'd suggest upgrade your ChromeDriver first before doing anything else, as your version is way out of date. From the changelog here, version 2.4 is 5 months old and the latest is 2.9, which supports Chrome 31-34. (Version 2.4 claims to support Chrome 32, but your Chrome 32.0.1700.107 m now is the latest, which wasn't the one when ChromeDriver 2.4 was released.)
With Selenium RC 1.0.1, and FF3.5.x or 3.6 I keep seeing this error when trying to run any test,
Failed to start new browser session:
Unable to delete file
\parent.lock
when running the server with either,
java -jar selenium-server.jar -multiwindow
or
java -jar selenium-server.jar
Any one found a way to run a selenium RC test against those version of FF? Here's the full stack trace,
ERROR - Failed to start new browser session, shutdown browser and clear all session data
java.lang.RuntimeException: Firefox refused shutdown while preparing a profile
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.wai
tForFullProfileToBeCreated(FirefoxChromeLauncher.java:311)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.pop
ulateCustomProfileDirectory(FirefoxChromeLauncher.java:106)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.lau
nch(FirefoxChromeLauncher.java:83)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.lau
nchRemoteSession(FirefoxChromeLauncher.java:350)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchRem
oteSession(FirefoxLauncher.java:98)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSessi
on(BrowserSessionFactory.java:357)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession
(BrowserSessionFactory.java:122)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession
(BrowserSessionFactory.java:84)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowse
rSession(SeleniumDriverResourceHandler.java:699)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(Se
leniumDriverResourceHandler.java:393)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleComman
dRequest(SeleniumDriverResourceHandler.java:364)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(Selen
iumDriverResourceHandler.java:125)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:
245)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher$Fil
eLockRemainedException: Lock file still present! C:\DOCUME~1\ADMINI~1.SPS\LOCALS
~1\Temp\customProfileDirf09f31ccacf4468385010edaecd5925d\parent.lock
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.wai
tForFileLockToGoAway(FirefoxChromeLauncher.java:269)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.wai
tForFullProfileToBeCreated(FirefoxChromeLauncher.java:309)
... 20 more
INFO - Got result: Failed to start new browser session: Unable to d
elete file C:\DOCUME~1\ADMINI~1.SPS\LOCALS~1\Temp\customProfileDirf09f31ccacf446
8385010edaecd5925d\parent.lock on session null
Restarting the browser, and clearing the cache didn't help. Using FF 3.0.x works just fine.
Seems seleniumRC 1.0.2 just came out today with claimed support for FF3.6 and such. Is working for me.
I was able to fix this issue by following these instructions:
http://jira.openqa.org/browse/SRC-507
This is for an older version of Selenium, but it works just the same. I am having to use 1.0.1 (for IE compatibility) and it has the MaxVersion of FF at 3.5. It was throwing the same error as above.
I changed the various files to '3.6' and it works now.
I just downloaded Selenium RC 1.0.3, and it did NOT fix the problem for me.