I am using Selenium WebDriver with Ruby and am attempting to create a script that will test in IE8. I am unable to find an answer on how to set iedriver to launch in IE8 mode or how to switch it to IE8 after webdriver has launched. I am on Windows 7 so I only have IE9 available to me. The code I am currently using to launch webdriver in IE9 is
$driver = Selenium::WebDriver.for :ie
Any help would be greatly appreciated. I have looked high and low but cannot find any sort of answer to this question. If you need additional info from me I will happily provide it. Thank you very much.
If you want to tell the IE version during run time, you can use DesiredCapabilities.
DesiredCapabilities ieCapabilities = null;
ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setBrowserName("internet explorer");
ieCapabilities.setVersion("Version Number");
driver = new InternetExplorerDriver(ieCapabilities);
For more info about DesiredCapabilities use this link http://code.google.com/p/selenium/wiki/DesiredCapabilities.
In the comments you said that i need both IE 8 and 9. Actually it is not possible, Windows currently supports to install only one IE version in a box. The IEDriver used the installed version of IE to launch.
If you want to use multiple version of IE to test then the better option to go with Windows Virtual Machines. You can talk with virtual machines by using the RemoteWebdriver instances.
Actually, this is currently not supported by Selenium WebDriver. There is currently an enhancement request for the IE modes to be implemented as a part of the DesiredCapabilities functionality referenced in the comment from Manigandan.
You can follow this enhancement request here: http://code.google.com/p/selenium/issues/detail?id=2564
Other possible solutions mentioned on the enhancement request is manipulating the FEATURE_BROWSER_EMULATION registry key (see http://msdn.microsoft.com/en-us/library/ee330730(v=vs.85).aspx ) or using keyboard commands to open Developer Tools and selecting the mode from there (I am not sure how well this solution would work, as the workaround in Python requires the WebDriver object to be cast as a Selenium 1.0 object).
Related
The release notes for ChromeDriver 2.33 says that ""Fixes a bug which caused Resizing/Positioning Window commands to fail on Chrome 62+" however this still seems to be an issue when i am using Chrome 62+ browser. Maximizing chrome window using chrome driver results in below exception. Does anyone know a solution please?
Another thing i noticed is, though i installed latest chromedriver (v2.33) from https://chromedriver.storage.googleapis.com/index.html?path=2.33/, the log printed below says Driver info: chromedriver=2.25.426923 !!
Exception in thread "main" org.openqa.selenium.WebDriverException:
unknown error: cannot get automation extension from unknown error:
page could not be found:
chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: chrome=62.0.3202.62) (Driver info:
chromedriver=2.25.426923
(0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT
10.0.15063 x86_64) (WARNING: The server did not provide any stacktrace information)
There are exactly 2 issues.
As you mentioned, you have installed latest chromedriver (v2.33) but the log printed below says Driver info: chromedriver=2.25.426923, this issue must be addressed first. You can consider to manually kill all the dangling chromedriver.exe tasks from the Task Manager. Additionally you can consider to use CCleaner to wipe out all the rotten OS stuffs from your system. Take a system reboot if required. Finally ensure that what ever the absolute location of chromedriver.exe you are using within System.setProperty() ensure that the chromedriver binary is of version 2.33.
Finally, it is suggested to use ChromeOptions class to maximize the Web Browser as follows:
System.setProperty("webdriver.chrome.driver", "C:\\your_directory\\chromedriver.exe");
ChromeOptions opt = new ChromeOptions();
opt.addArguments("disable-infobars");
opt.addArguments("--start-maximized");
opt.addArguments("--disable-extensions");
WebDriver driver = new ChromeDriver(opt);
driver.get("https://google.com");
Here are some of the alternatives which may solve your question:
Using maximize() from WebDriver.Window interface :
driver.manage().window().maximize();
Using setSize(Dimension targetSize) from WebDriver.Window interface:
driver.manage().window().setSize(new Dimension(800, 600));
Using addArguments("--start-maximized") through ChromeOptions:
chromeOptions.addArguments("--start-maximized");
Using addArguments("--window-size=1920,1080") through ChromeOptions:
chromeOptions.addArguments("--window-size=1920,1080");
Using executeScript() from JavaScriptExecutor interface:
((JavaScriptExecutor)driver).executeScript("window.resizeTo(1024, 768);");
You can find a related discussion in Chrome - org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension at driver.manage().window().maximize();.
I believe there were some old chrome driver processes running in backend and same were being picked up when it was invoked via code. I deleted all processes instances, deleted old version of chrome driver, added the new 2.33 version and it worked. Thanks all for your suggestions.
I think the reason behind it may be your chrome version. Try again with updating your chrome browser. I have faced this type of issues for compatibility between chrome browser & the driver
Use class ChromeOptions.
System.setProperty("webdriver.chrome.driver", "h:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("disable-infobars");
options.addArguments("--start-maximized");
WebDriver driver = new ChromeDriver(options);
driver.get(url);
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: C:\Users\\AppData\Local\Temp\2\tmpc2_p3ubt If you specified a log_file in the FirefoxBinary constructor, check it for details.
When I try to run my Python script, Firefox is timing out. Does anyone have any suggestions on which versions i need to match?
Uninstall current firefox version than Download Firefox from this link https://ftp.mozilla.org/pub/firefox/releases/46.0.1/win64-EME-free/en-GB/Firefox%20Setup%2046.0.1.exe and then try again
Note : you have to uncheck automatic upgrade of firefox after install of 46 using below setps:
Goto Options
Goto advance
Under Firefox updates: Never check for updates (not recommended: security risk)
If you want to run on firefox >= 48 then you need to upgrade to selenium 3beta. https://seleniumhq.wordpress.com/2016/07/29/announcing-selenium-3-0-beta1/
It wont and its a known issue, Refer thread here
https://github.com/SeleniumHQ/selenium/issues/2559
Can't fix.
In Firefox 48, Mozilla requires extensions to be signed. They have
refused to sign Selenium's Firefox driver extension (webdriver.xpi).
Feel free to contact them and/or log an issue for them at
https://bugzilla.mozilla.org
The way forward now is to use GeckoDriver. Which is now the default
implementation used in 3.0-beta
This issue has been known as a long time coming, I highly recommend
pinning your automation to use Firefox 45 ESR until a release of using
GeckoDriver/marionette is stable enough for your tests.
Gecko Driver is a way forward.
I am having a problem whereby running a test using selenium webdriver in firefox starts the firefox browser with firefox webdriver disabled as shown below.
Because of this the test times out with the error
org.openqa.selenium.WebDriverException: Failed to connect to binary
FirefoxBinary(C:\Program Files\Mozilla Firefox\firefox.exe) on port 7055; process output follows:
If I quickly enable the webdriver and restart the browser the test manages to run and complete itself so I'm guessing the problem is just that this add-on starts disabled when running a test.
How can I remedy this? Thanks!
Check the version of Selenium and FireFox you're using. Incompatible versions can result in these kinds of problems. See: Where can I find a definitive Selenium WebDriver to Firefox Compatibility Matrix?
Unfortunately the only option at the moment is to use Marionette WebDriver
https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
That works for Selenium 3 WebDriver tests. However if you use some framework on top of this you should check its roadmap to get information on when "geckodriver" or Marionette is going to be supported there.
Most likely the easiest approach to solve the issue in question for now is to downgrade browser (e.g. to Firefox 46) and use FireFox driver.
Try remove the extension completely. Normally Seleniums FirefoxDriver is enough to start your test.
WebDriver driver = new FirefoxDriver();
This should work without any external Firefox Plugins.
present in my current machine i am using Mozilla Firefox 9 so i have small task to check on Firefox 7.
Any body help how to check multiple versions at a time for example IE tester if any one give reference related to my requirement. it is much use full for me.
Do you mean: MultiFirefox
After a recent upgrade to Firefox 4, all of my automated selenium tests seem to be hanging on the initial 'Launching Firefox...' command during testing.
Has anyone seen a fix for this, or is my best bet to downgrade?
Have you updated to Selenium 2.0b3? Earlier versions don't support FF4.
** EDIT* *
RC2 is now available:
http://code.google.com/p/selenium/downloads/list
I was having the same issue. 'Launching Firefox' command, a blank Firefox window opens and the test hangs. Looking at the Firefox Add-ons the three extensions that Selenium installs were all incompatible and disabled. Turns out my test was still accidentally starting up the wrong selenium version. Switching to 2.0b3 fixed the issue.
Recommend you to use latest version of selenium with firefox 4. for me it is working fine withoutany problem.
I am using :
Selenium Server : selenium-server-2.0b2
I hope it helps.