I am using Selenium WebDriver to take a screenshot of webpages. It runs great. However, from the time I hit run in eclipse to the time the screenshot shows up in my local dr
What you are asking for (allowing WebDriver
to attach to a running browser) has been an issue now for almost 3 years. To date, this feature has still not been added. As far as I am aware, there is no way to make Firefox load any faster. You can try a few other tricks though.
fp.setPreference("webdriver.load.strategy", "unstable")
Quoting the caveat from this page:
There is beta feature to make firefox not wait for the full page to load after calling .get or .click. This may cause immediate find's to break, so please be sure to use an implicit or explicit wait too. This is only available for Firefox and not other browsers.
You can also try loading with a profile and see if that helps at all.
This thread shows a possible explanation.
To summarize, Selenium loops through all network cards and calls a method (getHostName) that takes a long time for virtual network cards. Disabling them solved the problem of the OP in the thread.
(In my own case, I am unable to disable any of them and have to wait at the start of each test case...)
I realize that this question has already been answered, but I hope this helps anyone with the same problem.
If all you need to do is take screenshots. I recommend using Awesomium.NET. http://awesomium.com/
Doing this in C# rather than Java shouldn't be a major difficulty since they have similar syntax. It also supports C++ if you want to run your application on Linux. I presume it will be significantly faster than the WebDriver.
Use this if you choose C++: http://labs.awesomium.com/capturing-web-pages-with-c/
For C#.NET: http://awesomium.com/docs/1_7_rc3/sharp_api/
From the things I learned elsewhere -
References:
https://sqa.stackexchange.com/questions/1988/selenium-reuse-existing-browser-session-instead-of-opening-new-windows
http://www.codeweavers.net/6-ways-to-speed-up-selenium-tests/
http://sauceio.com/index.php/2011/02/speed-up-your-selenium-tests/
Hope this helps!
For me it worked with 64bit version of IEDriverServer, I added the property requireWindowFocus with Value:"true".
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability("requireWindowFocus", true);
WebDriver driver = new InternetExplorerDriver(capabilities);
I had the same issue in Windows and the cause was related to resolving localhost
. In this case there are two ways to fix it:
replace localhost with 127.0.0.1 (so go to urls like http://127.0.0.1
). However this messes with network.automatic-ntlm-auth.trusted-uris
setting when testing against web application using NTLM authentication, as it requires a hostname, not an IP address
change hosts
(e.g. C:\Windows\System32\drivers\etc) to directly solve localhost to 127.0.0.1:
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
# ::1 localhost