Selenium/Webdriver tests execution time doubled after upgrading to 2.45 - selenium

after the upgrade from selenium 2.44 to 2.45 the execution time is 2-3 times longer than before. I have been executing the tests with Firefox 36 in a Linux/Ubuntu and a Windows XP environment.
What could be the reason behind this slower speed? Do I have to configure FirefoxDriver differently or something like that?

There is a known issue with the FirefoxDriver 2.45, see https://code.google.com/p/selenium/issues/detail?id=8551
Until it gets fixed the workaround is to downgrade Firefox & selenium.
BTW: Don't forget to star this issue at google code! Maybe it will help to speed up the fix ;-)

Related

Selenium for Chrome version 103 is just crashing, I know it's not my code because whilst its still crashing at one time it still ran

The script is crashing on Chrome version 103 only it's still running on 102. In one instance, it ran but crashed while executing a loop for its fifth time. It is selenium + python. What should I do?
this issue came with chrome 103. Remove the user-data-dir option for solution.
It was fixed for me when I removed the user-data-dir option.
It looks like this problem will go away when chrome 104 is released, we'll be dealing with workarounds until chrome 104 comes out.
https://bugs.chromium.org/p/chromedriver/issues/detail?id=4121
https://github.com/SeleniumHQ/selenium/issues/10799
New Answer
Chrome Version 103.0.5060.134, selenium is now working as normal
Old answer
I actually:
Uninstalled Google Chrome
Restarted the computer
Installed an older version of Chrome(whilst the Internet is OFF)
Run MS config & disable Chrome auto-update
Restart the computer.
Now it runs just FINE.
NB: This can make your computer vulnerable to attacks so don't use your main PC. Use Isolated Environments
.

How to setup Selenium 4 for old Chrome version?

By some project reasons I have to use Selenium 4 (4.0.0-rc3) and Chrome version 71.
Of course the current chromedriver (version 94) doesn't work with old chrome.
I have downloaded the source code of chromium project for debugging and try to understand how actually driver works with selenium. Probably I will try to make my own driver version but at this moment it seems like an inefficient solution.
I am really stuck with this and will be happy to get any advice.
Is it possible just to configure driver by capabilities (or any parameters) for working with old chrome?
The Chrome version you're targeting Chrome 71 is already deprecated. Using Selenium 4 with this much obsolete version of Chrome will not work and I think apart from creating your own code piece, there is nothing much you can do.
Using such an obsolete piece of software, in this age of internet, will open a pot of bugs for you, and if you use this to connect to internet, then chances are people may exploit any hidden security vulnerabilities to attack your application.
I would strongly suggest you to talk within your project team to use an updated version of Chrome.
ChromeDriver 2.46 will work with Chrome 71.

Selenium Chromedriver issue after Windows 10 1803 update

After latest Windows 1803 Update. We are facing issue with selenium scripts launching chromedriver.
If scripts are put for overnight executions, after some time scripts starts failing with below exception of webdriver
org.openqa.selenium.WebDriverException: Timed out waiting for driver
server to start
Below are the dependency versions used
Selenium : 3.141 Chromedriver : 2.46 Chrome Version : 72 Java version
: 1.8.0_201
Please let us know if anyone encountered above issue after Windows 1803 upgrade
Regards,
Naveen
Is there a reason why you cannot use RemoteWebDriver instead?
In my experience, RemoteWebDriver tends to be the best way to avoid driver errors when running tests, unless you need to do something oddly specific to ChromeDriver.
https://github.com/SeleniumHQ/selenium/wiki/RemoteWebDriver

Firefox Webdriver is extremely slow

We use the selenium webdriver dlls set up to run my automation suite. I encounter this problem when runnning tests in Firefox only. The tests in Firefox run very slow , taking 3-4 minutes to load pages, However, when I run the same test on the same machine using Firefox browser manually I don't encounter this slowness. At times while running automation on Firefox, we also get "Connection was reset" page. Also, the same tests run fine in Chrome and IE.
We use the following environment:
Firefox version 28, 37 (proxy is set to use system settings)
Webdriver (dlls) version 2.45
Windows 7
Earlier we used to run the same set up in Windows XP using Firefox version 14,16, and Webdriver version 2.37, we didn't experience this issue.
We invoke Firefox using the following code :
Proxy proxy = new Proxy();
proxy.Kind = ProxyKind.System;
FirefoxProfile profile = new FirefoxProfile();
profile.SetProxyPreferences(proxy);
RemoteWebDriver dr = new FirefoxDriver(new FirefoxBinary(#"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"), profile, TimeSpan.FromSeconds(120));
dr.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(3));
dr.Manage().Window.Maximize();
dr.Manage().Cookies.DeleteAllCookies();
dr.Navigate().GoToUrl(WebSiteUrl);
remaining tests steps......
Please can someone help me resolve this issue.
Thanks in advance.
This is how I solved the "extremely slow FirefoxDriver" problem:
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
service.Host = "::1";
IWebDriver driver = new FirefoxDriver(service);
The above code forces the geckodriver to use the IPv6 protocol, which works many times faster for the interactions with the UI elements.
Probably won't do you any good now, but I had the same problem with Firefox 45 and Webdriver 2.15. Turned the problem was the implicit wait setup. In my case, I had:
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
This one line was taking 190 seconds (yes, more than 3 minutes!) to execute. Removing it cut the startup time to under 8 seconds!

PhantomJS: Slow from CI(Jenkins) server, but faster when executed from developers machine(Windows)

I am having a really hard time figuring out as to why the selenium test cases are running slowly with phantomjs ghostdriver. When the developers run the test cases against the dev environment it runs faster(takes 1 hour to complete 5 test cases), but when ran from jenkins, it takes 4 hours.
I turned off the IPV6 on the dev machine, also tried switching to version 1.9.1, but still no improvement on the time taken.
Jenkins Machine
phantomJS: 1.9.2
Jenkins Server: RHEL 5.6 64 bit
JDK: 1.7
Developer Machine
OS: Windows 7 64 bit
JDK: 1.7
phantomJS: 1.9.2
Can someone please help?
Thanks in advance
Are you using driver.quit() or phantom.exit() after each test case as phantomJS process not get killed automatically. If no then it could be the reason of slowing down your test cases.
If your tests do not quit the drivers, your jenkins box will have a lot of open browsers in memory after a while.
For instance, every test that starts, then asserts false somewhere and dies, leaves an unclosed driver. These tend to build up after a while.
Depending on your testing framework.. there may be good solutions around it other than wrapping each test in their own try/catch blocks.
py.test has great fixture functionality. You can have a phantomjsdriver() fixture that opend the browser for each test, then after the test is done (safely, or aborting from a False assertion) it can finalize and close up the driver.
psudocode example: (py.test, python, selenium)
#pytest.fixture
def phantomdriver(request):
driver = webdriver.phantomJS()
def fin():
driver.close()
request.addfinalizer(fin)
In this situation, every test that uses this fixture, no mater how it exits, will end up calling the finilizer fin() to close it.