Selenium RC: "waiting for window 'null' local frame 'null'" - selenium

I am totally at a loss here, trying to run a minimal Selenium RC style test. The issue I'm experiencing has been described by a lot of users on the web but none of the widely varying solutions solved the problem in my case. What happens is that Firefox will open, but with what looks like an empty profile to me, because it opens the "Welcome to Firefox!" page. Apart from that, nothing happens in the browser and in the Selenium server log I find this:
DEBUG [12] org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory - Requested browser string '*firefox c:\progra~2\mozill~1\firefox.exe' matches *firefox
DEBUG [12] org.openqa.selenium.browserlaunchers.locators.BrowserLocator - Checking whether Firefox 3 launcher at :'c:\progra~2\mozill~1\firefox.exe' is valid...
DEBUG [12] org.openqa.selenium.browserlaunchers.locators.BrowserLocator - Discovered valid Firefox 3 launcher : 'c:\progra~2\mozill~1\firefox.exe'
INFO [12] org.openqa.selenium.server.BrowserSessionFactory - Allocated session 962d2221ccb4459b9adbad1b8734850c for http://www.google.com, launching...
DEBUG [12] org.openqa.selenium.server.browserlaunchers.ResourceExtractor - Extracting /customProfileDirCUSTFFCHROME to C:\Users\zb\AppData\Local\Temp\customProfileDir962d2221ccb4459b9adbad1b8734850c
INFO [12] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Preparing Firefox profile...
INFO [12] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Launching Firefox...
DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for window 'null' local frame 'null' for 1800 more secs
DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for condition for 1000 more ms
DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - got condition? : false
The last three lines are then repeated every second until I stop the Selenium server again.
This is my test code:
import com.thoughtworks.selenium.DefaultSelenium;
public class Runner {
public static void main(String[] args) {
DefaultSelenium selenium = new DefaultSelenium("localhost", 4444,
"*firefox c:\\progra~2\\mozill~1\\firefox.exe",
"http://www.google.com");
selenium.start();
selenium.open("/");
selenium.type("q", "test");
selenium.click("btnK");
selenium.stop();
}
}
I tried:
different versions of Firefox (22, 21, 20)
different versions of Selenium server (2.33.0, 2.25.0, 2.15.0, a CI build)
different versions of the Selenium client driver
different versions of the Oracle JDK (1.6u24, 1.6u45, both 32- and 64-bit versions)
various Firefox browser launchers in the test code
specifying the browser path in the test code or not
running Selenium server as Administrator or not
various Selenium server options (with/out custom profile, multi-window mode, etc.)
different locations for Firefox and the custom profile (i.e. path with/out spaces)
a similiar test like the Java one above, written in Perl
It all doesn't help and ends up like I described above. I'm on a Windows 7 machine (64bit). By the way, a small WebDriver test I tried works as expected.
Edit: Renamed question, because the server doesn't actually "hang", it just doesn't work as expected.

I went back to Firefox 17 ESR (Extended Support Release) and suddenly the tests came back to life (using Selenium server 2.33.0).
This problem seems to be an indicator for version incompatibilites between Selenium server and Firefox. Unfortunately, there's not much, or anything, to be found in the documentation on this matter - but then again, as #Pavel Janicek mentioned, Selenium RC is deprecated. What I've been able to grasp from the CHANGELOG is that Selenium server 2.32.0 explicitly supports Firefox 10 ESR, 17 ESR, 19 and 20. For 2.33.0, no additional browser versions are mentioned, leaving Firefox 21+ officially unsupported, although not everyone agrees.
To wrap it up: If you see this error, the only solution may be to step down the list of supported browsers in the current CHANGELOG until your tests run again.

I hit the same problem, but I could get around it by updating to selenium-server-standalone-2.35.0.jar from https://code.google.com/p/selenium/downloads/list, with Firefox version 24 installed on Ubuntu 12.04 using apt-get (version is 24.0+build1-0ubuntu0.12.04.1).

Related

Selenium not go to url when open profile firefox [duplicate]

As the documentation states, you can call webdriver.FirefoxProfile() with the optional argument of profile_directory to point to the directory of a specific profile you want the browser to use. I noticed it was taking a long time to run this command, so when I looked into the code, it looked like it was copying the specified profile Problem is, it takes an extremely long time for the profile to copy (something like >30 minutes, didn't have the patience to wait for it to finish.)
I'm using a hybrid of userscripts and selenium to do some automation for me, so to setup a new profile every single time I want to test out my code would be burdensome.
Is the only way to change this behaviour to edit the firefox_profile.py itself (if so, what would be the best way to go about it?)?
As per the current implementation of GeckoDriver with Firefox using the FirefoxProfile() works as follows :
If case of initiating a Browsing Session through a new Firefox Profile as follows :
from selenium import webdriver
myprofile = webdriver.FirefoxProfile()
driver = webdriver.Firefox(firefox_profile=myprofile, executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()
A new rust_mozprofile gets created on the run as follows :
1521446301607 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\ATECHM~1\\AppData\\Local\\Temp\\rust_mozprofile.xFayqKkZrOB8"
Of-coarse on a successful closure (i.e. successful invocation of driver.quit()) the temporary rust_mozprofile.xFayqKkZrOB8 gets deleted/destroyed completely.
Again in case of initiating a Browsing Session through an existing Firefox Profile() as follows :
from selenium import webdriver
myprofile = webdriver.FirefoxProfile(r'C:\Users\AtechM_03\AppData\Roaming\Mozilla\Firefox\Profiles\moskcpdq.SeleniumTest')
driver = webdriver.Firefox(firefox_profile=myprofile, executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()
Similarly a new rust_mozprofile gets created on the run as follows :
1521447102321 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\ATECHM~1\\AppData\\Local\\Temp\\rust_mozprofile.2oSwrQwQoby9"
Similarly in this case as well on a successful closure (i.e. successful invocation of driver.quit()) the temporary rust_mozprofile.2oSwrQwQoby9 gets deleted/destroyed completely.
So the timespan you are observing is the time needed for a FirefoxProfile() to scoop out a new rust_mozprofile.
Perhaps as per your question timespan for profile to copy (something like >30 minutes) is a pure overhead. So it won't be possible to use a Firefox Profile without making a copy of rust_mozprofile.
Solution
Upgrade Selenium Client to current levels Version 3.11.0.
Upgrade GeckoDriver to current GeckoDriver v0.20.0 level.
Upgrade Firefox version to Firefox Quantum v59.0.1 levels.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Firefox base version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Firefox Quantum.
Execute your #Test.

Chrome driver failing when using Behave

I'm starting to look at Behave to use for BDD, but I've hit a problem. I have a quite few Selenium (Python) tests that I'm already running successfully, but as soon as I use behave I get an error "chromedriver.exe has stopped working".
In my Selenium tests (using pytest and running it from PyCharm), the test looks as follows (which works fine):
def test_open_google():
driver = webdriver.Chrome('C:/temp/chromedriver.exe')
driver.get('http://www.google.com')
I've then created a steps file (as part of the BDD testing), which contains the following:
#when('I open Google')
def step_impl(context):
driver = webdriver.Chrome('C:/temp/chromedriver.exe')
driver.get('http://www.google.com')
From the command line I run "behave" and get the error popup saying "chromedriver.exe has stopped working.
Does anyone know how I can fix this?
It looks like Behave is not compatible with any of the 32 bit webdrivers. I got the same problem when I used the 32 bit IE driver, but it works when I use the 64 bit driver.

Chrome Driver Error using Selenium: Unable to Discover Open Pages

I'm getting a Chrome Driver related error when running my Selenium tests. The error message is "Unable to Discover Open Pages." The Selenium tests were all running fine until last evening. The problem seemed to begin after a reboot of the server the day before. I cannot reproduce this error on my local box. Running the Selenium tests from the command line on the server does open the Chrome Browser but results in the same error. Any ideas?
Line that is failing:
chromeDriver = new OpenQA.Selenium.Chrome.ChromeDriver(externalDriverPath);
Error message and stacktrace:
unable to discover open pages (Driver info:
chromedriver=2.1,platform=Windows NT 6.1 SP1 x86_64) at
OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response
errorResponse) at
OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String
driverCommandToExecute, Dictionary`2 parameters) at
OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities
desiredCapabilities) at
OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor
commandExecutor, ICapabilities desiredCapabilities) at
OpenQA.Selenium.Chrome.ChromeDriver..ctor(String
chromeDriverDirectory, ChromeOptions options) at
OpenQA.Selenium.Chrome.ChromeDriver..ctor(String
chromeDriverDirectory) at SeleniumTests.BaseTest.SetupBrowsers()
When creating an instance of the ChromeDriver, a console window appears. The server with the error seems to refer to things NOT IMPLEMENTED.
ChomeDriver Output From the Server with the Error:
Started ChromeDriver (v2.1) on port 2984
[4700:4292:0108/111503:ERROR:gpu_info_collector_win.cc(102)] Can't
retrieve a va lid WinSAT assessment.
[4700:4292:0108/111503:ERROR:chrome_views_delegate.cc(176)] NOT
IMPLEMENTED
[4700:4292:0108/111503:ERROR:desktop_root_window_host_win.cc(746)] NOT
IMPLEMENT ED [0108/111504:ERROR:gl_surface_egl.cc(132)] eglInitialize
failed with error UNKNO WN [0108/111504:ERROR:gl_surface_win.cc(97)]
GLSurfaceEGL::InitializeOneOff failed.
ChomeDriver Output From My PC which works fine:
Started ChromeDriver (v2.1) on port 18786
[884540:883760:0108/114010:ERROR:gpu_info_collector_win.cc(102)] Can't
retrieve a valid WinSAT assessment.
[884992:884996:0108/114010:ERROR:base_feature_provider.cc(122)]
manifestTypes: A llowing web_page contexts requires supplying a value
for matches.
[885232:885236:0108/114011:ERROR:base_feature_provider.cc(122)]
manifestTypes: A llowing web_page contexts requires supplying a value
for matches.
[884540:883760:0108/114011:ERROR:base_feature_provider.cc(122)]
manifestTypes: A llowing web_page contexts requires supplying a value
for matches. [0108/114011:ERROR:gl_surface_egl.cc(131)] eglInitialize
failed with error UNKNO WN [0108/114011:ERROR:gl_surface_win.cc(54)]
GLSurfaceEGL::InitializeOneOff failed.
You are using a highly outdated version of the ChromeDriver. Your first port of call should be to update it here.
I would highly suspect the problem is your Chrome on your server has updated, and ChromeDriver v2.1 doesn't support any recent versions of Chrome.
Look here for other possible solutions: https://groups.google.com/forum/?hl=en#!topic/selenium-users/gfvfH-YEC48
In my case, adding the --no-sandbox argument to ChromeOptions solved the problem.
Here's a quick workaround I found while digging around to get rid of that error: unknown error: unable to discover open pages
In your protractor config file, add the following:
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--no-sandbox']
}
},
The most important line there is the --no-sandbox; adding that line somehow gets rid of that error.
I am not exactly sure why it works but it's a workaround I found while digging around online.
***********************************UPDATES as of 10/04/2016***********************************
Please ignore this part right above as that workaround is NOT a proper fix; below I show you the actual fix to your problem; you just have an outdated chrome driver and running "webdriver-manager update" will only update up to v2.22 so I'll show you how to grab v2.24 right below.
Read on if your webdriver-manager update doesn't update chromedriver
to the latest i.e past v2.22 OR to v2.24 as of 10/04/2016.
I lost a few weeks pulling my hair around an issue I had with "Unable to discover open pages" and every time I would update the chromedriver, it would update to version 2.22 for chromedriver and I believe the selenium server to v2.53.
My problem wasn't really with the selenium server so v2.53 was fine.
Issue was with chromedriver v2.22.
Eventhough this chromdriver link showed that there was a latest version of 2.24, 'webdriver-manager update' would NOT pick up that latest version, it would only grab version 2.22 of the chrome driver.
How did I go around this?
Simply run the command below after you check this link for which version of chromedriver you want to update to; for instance, I wanted v2.24 so I ran the command below:
webdriver-manager update --versions.chrome 2.24
If you check your location: C:\Users\<USER>\AppData\Roaming\npm\node_modules\webdriver-manager\selenium\
You should see that the desired chromedriver was downloaded there; if it's not there, read the command prompt logs and it'll tell you where it downloaded your chromdriver files.
Hope that helps someone!
I had the same problem, but updating to the latest ChromeDriver (v2.8) did not solve it for me. I was running Selenium on a CI server (A Dell machine running 64 bit Win 7). I got the exception every time when the server had been 'idle' for a while.
What fixed the problem for me was to set 'Turn off display after' in Windows' Power Options to 'Never'.
I am running selenium with python in Docker on a Google compute instance. For me, the issue was that my instance didn't have enough memory, and my scrape job would fail with this error. Upgrading it to g1-small resolved the issue for me.
In my case the problem was due to one of my colleagues, who started his tests at the same time on the same server, so that my web driver could not access the Chrome executable. It also happens if someone didn't finish his web driver process properly, in this case you have to kill it manually.
First make sure you have updated you chrome browser, through the Menu UI.
Then update ChromeDriver, here.
For some reason the Chrome driver cannot interpret https traffic. If you change your link to http it will work nicely.

Running selenium test automatically

I have a problem with Selenium and can't get it to work.
What I want to do:
A customer of ours sends us a Selenium test case which shall be executed automatically in several locations and the time taken shall be recorded.
We want to use Selenium and Firefox Portable, because we want to make the tests completely independent of any user input and the installed software at the different locations.
So much for the starting conditions ;)
What we did so far:
The first version was completely written in Java, we exported the test case from the customer to Java with the Selenium IDE Plugin -> Export to Java WebDriver.
This cannot be done anymore, because the customer now uses some functions the WebDriver export does not support. And as we don't want to alter the test from the customer, Java export is no longer an option.
So for the first run we are using this command (any variables are set correctly):
java -jar selenium-2.33.0/selenium-server-standalone-2.33.0.jar -port 5555
-firefoxProfileTemplate "Firefox\Data\profile" -log logs\selenium_server.log
-htmlSuite "*firefox" http://localhost:5555 Testsuite.html
logs\results-firefox-%curTimestamp%.html
This starts my preinstalled firefox, not the portable one. On the customers machine, no firefox is started whatsoever, because it is not installed. So I had to provide the path to the firefox instead, using the "custom" htmlSuite:
java -jar selenium-2.33.0/selenium-server-standalone-2.33.0.jar -port 5555
-firefoxProfileTemplate "Firefox\Data\profile" -log logs\selenium_server.log
-htmlSuite "*custom %FF_DIR%\FirefoxPortable.exe" http://localhost:5555 Testsuite.html
logs\results-firefox-%curTimestamp%.html
This does not work, as the Selenium Server cannot execute this command if run under Windows, which we do (see: http://code.google.com/p/selenium/issues/detail?id=3274)
As comment #6 has some diffs, we patched the selenium Server standalone Jar and ran the test again. Now the browser could be started, but the test could not be run. After the first page loaded we get the error "Permission denied to access property 'document'".
A solution here suggests, a user-rights problem could be the cause and you should try the "chrome" htmlSuite (see: https://sqa.stackexchange.com/questions/1453/how-to-fix-permission-denied-to-access-property-document)
So we did:
java -jar selenium-2.33.0/selenium-server-standalone-2.33.0-patched.jar
-port 5555 -firefoxProfileTemplate "FirefoxPortable\Data\profile"
-log logs\selenium_server.log -htmlSuite "*chrome %FF_DIR%\FirefoxPortable.exe"
http://localhost:5555 Testsuite.html logs\results-firefox-%curTimestamp%.html
Notice our "patched" selenium and the "chrome" htmlSuite.
That didn't work, as well.
So, here in short the results:
htmlSuite = firefox: the preinstalled Firefox is used, if installed, not the Portable one. In case, no FF is installed, the test fails altogether
htmlSuite = chrome: the server cannot start the browser, as it tries to set EnvironmentVariables, which is not supported running Windows (see: http://code.google.com/p/selenium/source/browse/java/client/src/org/openqa/selenium/os/WindowsProcessGroup.java#67 lines 67 following)
htmlSuite = googleChrome: Google Chrome Portable can be started, but the Chrome browser cannot find some elements specified by the test, so we cannot use Chrome (altering the test is no option, as stated above)
htmlSuite = iexplore: Internet Explorer starts, but then a JavaScript error appears, referencing a custom Profile created by Selenium, so the test does not work in IE, either
htmlSuite = custom: the Portable Firefox is started (yeehaw), but does not have sufficient rights to execute the test.
You may use a Continuous Integration System like Jenkins, or TeamCity to execute your tests automatically.
we have now decided to support the customer in installing Firefox on the machines to test, so we can use our batchfile without problems.
As for the bug in selenium look here (code.google.com/p/selenium/issues/detail?id=5554#c14), there is a link to a nightly build that does work (at least for us) with Firefox v23, which Selenium 2.33 does not.
Thanks for everyone who contributed, but I think my first approach can not be achieved the way I thought it could :(
I solved this problem.
Visit this link: http://www.townx.org/blog/elliot/dealing-self-signed-ssl-certificates-when-running-selenium-server-firefox
Point 9:
Delete everything in the directory except for the cert_override.txt and cert8.db files.
Hope it helps

Selenium node failing to run IE or Chrome web drivers

Here's simple batch file I wrote to start the node for selenium grid
set webdriver.ie.driver=C:\selenium-server\IEDriverServer.exe
echo %webdriver.ie.driver%
set webdriver.chrome.driver=C:\selenium-server\chromedriver.exe
echo %webdriver.chrome.driver%
java -jar selenium-server-standalone-2.32.0.jar -role hub
Yes both drivers exist in that directory and I've even added that directory to my System's Path variable. When I try to create a remote web driver like thus:
Platform platform = Platform.WINDOWS;
desiredCapabilities =new DesiredCapabilities("internet explorer", "9.0", platform);
driver = new RemoteWebDriver(new URL(gridUrl), desiredCapabilities);
I'm still getting an exception stating:
Exception: The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see htt
/p/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://code.google.com/p/selenium/downloads/list
I'm using the latest IEDriver and chromedriver and selenium server 2.32.0 (which I believe is the latest one too).
Running on windows 7. I've tried both the 32 and 64 bit drivers for IE. Get the same problem with the chrome driver.
Adding this option at the end of the command to start my node got everything working. Is this just poorly documented? did I miss something obvious? or is there still something weird going on?
-Dwebdriver.ie.driver=C:\selenium-server\IEDriverServer.exe