webdriver won't cooperate with firefox - firefox

I have been trying to use WebDriver to run some front-end Selenium tests, but it is refusing to cooperate with my Firefox. I try to start a new FirefoxDriver with no arguments, and get an error message.
It says
Selenium.WebDriverException: Failed to connect to FirefoxBinary(/usr/bin/firefox) on port 7055.
Then, it says:
Disabling foreign installed add-on fxdriver#googlecode.com in app-profile.
I have not installed any add-ons since starting the VM I'm running this in. What do these errors mean?

Please check the compatibility between Firefox and selenium webdriver versions.

Related

driver.manage().window().maximize() issue with ChromeDriver 2.33

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);

I have a jmx file where i have written selenium code with javascript. I am unable to run it in EC2 using jmeter

I have a jmx file where i have written selenium code with javascript. I am unable to run it in EC2 using JMeter.
Here is the error message.
unknown error chrome failed to start exited abnormally
Chrome failed to start
Looking into the log file it appears you're using ChromeDriver 2.20. It is quite an outdated version which supports Chrome (or Chromium) versions 43-48.
If you are using a newer Chrome - you have 2 options:
Upgrade to ChromeDriver 2.29 which supports Chrome versions 56-58
Downgrade your Chrome browser to version 43-48
References:
ChromeDriver Release Notes
Getting started with ChromeDriver on Desktop
The WebDriver Sampler: Your Top 10 Questions Answered
It seems you don't have neither Chrome nor specific Chromedriver on your EC2 machine.
For the latter, get it there, then you're going to set system property webdriver.chrome.driver to the path to your driver (including the executable name).
As for installing conventional chrome on that GUI-less machine - I'm quite not sure it's going to work, but you may try.
Although the package is anyway out of standard AWS package repositories, so you'd be driven to do that manually from local package.
Let me know if that helped, please.

Selenium 2.53.6 not working in Firefox 48.0.2

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.

Firefox Webdriver disabled when running test in selenium webdriver

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.

Firewatir not working

hi i am currently using firewatir.
But my browser opens but when it comes to the connecting to the site it fails it shows the home page of Firefox which is set by default..
error : Unable to connect to machine : 127.0.0.1 on port 9997. Make sure that JSSh is properly installed and Firefox is running with '-jssh' option caught in : open_browser
I have installed the Jssh also but i don't know whats is the problem.
Forget firewatir, it is dead. If you need to drive Firefox, use watir-webdriver gem. Depending on your OS, follow instructions in my Watir book: https://github.com/zeljkofilipin/watirbook/downloads

Resources