addons.manager ERROR startup failed: - java

I am getting this below error, is this really a error or just a warning message that I can ignore, please help. Also my test code runs well but opening another blank window in browser.
I am using selenium 3.4.0 Firefox browser 47.0.2 geckodriver-v0.16.1-win64
also need know the compatibility of versions of browser and selenium
Below is the testcode:
System.setProperty("webdriver.gecko.driver","E:\\Roma\\geckodriver-v0.16.1-win64\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver = new FirefoxDriver();
String vURL = "http://www.facebook.com";
driver.navigate().to(vURL);
driver.findElement(By.xpath("//*[#id='day']")).sendKeys("9");
driver.quit();
Console Error :
1507800976077 geckodriver::marionette INFO Starting browser \\?\C:\Program Files\Mozilla Firefox\firefox.exe with args ["-marionette"]
1507800976669 addons.manager ERROR startup failed: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIFile.create]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: resource://gre/modules/FileUtils.jsm :: FileUtils_getDir :: line 70" data: no] Stack trace: FileUtils_getDir()#resource://gre/modules/FileUtils.jsm:70 < FileUtils_getFile()#resource://gre/modules/FileUtils.jsm:42 < AddonManagerInternal.validateBlocklist()#resource://gre/modules/AddonManager.jsm:665 < AddonManagerInternal.startup()#resource://gre/modules/AddonManager.jsm:832 < this.AddonManagerPrivate.startup()#resource://gre/modules/AddonManager.jsm:2773 < amManager.prototype.observe()#resource://gre/components/addonManager.js:57
JavaScript error: resource://gre/modules/AddonManager.jsm, line 1639: NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized
1507800977720 Marionette INFO Listening on port 51248
JavaScript error: undefined, line 492: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getCharPref]
JavaScript error: resource://gre/modules/AddonManager.jsm, line 2484: NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized
Oct 12, 2017 3:06:20 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C

You need to update browser and geckoDriver , I will suggest use ff50 and 51 with geckodriver version 17 or 18.
also comment this line driver = new FirefoxDriver() no need to instantiate twice
System.setProperty("webdriver.gecko.driver","E:\\Roma\\geckodriver-v0.16.1-win64\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();
//driver = new FirefoxDriver();
String vURL = "http://www.facebook.com";
driver.navigate().to(vURL);
driver.findElement(By.xpath("//*[#id='day']")).sendKeys("9");
driver.quit()
;

In general, each GeckoDriver release supports each version of Mozilla Firefox releases (beginning with Firefox 48) where the property "marionette" needs to be set to true (either by default or through configuration)
If you are working with the legacy Firefox releases (till Firefox 47.x) GeckoDriver still works but you have to explicitly set the property "marionette" to false
Regarding the compatibility of GeckoDriver, Selenium and Mozilla Releases:
GeckoDriver Release Notes clearly states all the major/minor New Feature Addition, Enhancements,Bug Fixes and Download Location separately in this link.
Selenium Release Notes clearly states all the major/minor New Feature Addition, Enhancements,Bug Fixes and Download Location separately in this link
Selenium Dependencies:
Selenium 3.4.0 now recommends Geckodriver v0.16.0 strongly.
Selenium 3.3.1 better supports Geckodriver v0.15.0.
GeckoDriver Dependencies:
geckodriver v0.18.0 now recommends Firefox 53 and greater
geckodriver v0.16.0 is only compatible with Selenium 3.4 and greater.

Related

Selenium "can't kill an exited process" [duplicate]

Server: Raspberry Pi 3
OS: Dietpi - version 159
Geckodriver version: 0.22 for arm
Firefox version: 52.9.0
Python version: 3.5
Selenium version: 3.14.1
Gecko is executable, and is located in /usr/local/bin/
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.firefox.options import Options
import time
options = Options()
options.set_headless(headless=True)
driver = webdriver.Firefox(firefox_options=options)
print('Need your login credential')
username = input('What is your username?:\n')
password = input('What is your password?:\n')
...
...
Output:
root#RPi3:~# python3.5 ITE-bot.py
Traceback (most recent call last):
File "ITE-bot.py", line 12, in <module>
driver = webdriver.Firefox(firefox_options=options)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process
Any idea what is wrong? I've tried google without luck.
If you are running Firefox on a system with no display, make sure you use headless mode.
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)
Also, make sure you have compatible versions of Firefox, Selenium, and Geckodriver:
https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html
Thumb rule
A common cause for Browsers to crash during startup is running WebDriver initiated Browsers as root user (administrator) on Linux. While it is possible to work around this issue by passing --no-sandbox flag when creating your WebDriver session, such a configuration is unsupported and highly discouraged. You need to configure your environment to run Browser as a regular user instead.
This error message...
selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process
...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowsing Session i.e. Firefox Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Your GeckoDriver version is 0.22.0.
Release Notes of GeckoDriver v0.21.0 (2018-06-15) clearly mentions the following:
Firefox 57 (and greater)
Selenium 3.11 (and greater)
Your Firefox version is 52.9.0.
So there is a clear mismatch between GeckoDriver v0.22.0 and the Firefox Browser v57
Solution
Upgrade GeckoDriver to GeckoDriver v0.22.0 level.
GeckoDriver is present in the specified location.
GeckoDriver is having executable permission for non-root users.
Upgrade Firefox version to Firefox v62.0.2 levels.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Execute your Selenium Test as a non-root user.
GeckoDriver, Selenium and Firefox Browser compatibility chart
I was on headless mode, using correct versions of everything, and the only way to get out of this error message was not to execute the selenium test as root
Yes checked Start Xvfb before the build can fix the problem, but if you have a job like a pipeline or multibranch pipeline this option is not visible. In the node of your Selenium grid that you go to execute the test you need:
1- Install Xvfb: apt install xvfb
2- Execute Xvfb: /usr/bin/Xvfb :99 -ac -screen 0 1024x768x8 & export DISPLAY=":99"
3- Rerun your node, for example: java -jar selenium.jar -role node -hub http://#.#.#.#:4444/grid/register -capabilities browserName=firefox,plataform=linux -host #.#.#.# -port 1991
This solution worked for me
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)
As there can be many different underlying causes for this error it is best to find the root cause setting selenium to use debug level logging. In my case, for Ruby with capybara I needed to set: Selenium::WebDriver.logger.level = :debug. And voilĂ , running the same spec I could see in the logs that a dependency was missing, in my case:
libdbus-glib-1.so.2: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
After installing it all worked fine.
I used:
VS Code
Linunx/Ubuntu:18.10
Nightwatch.js
My problem was that I tried to run Nightwatch (which automatically starts GeckoDriver) from the VS Code terminal.
I had the same problem, and realized that the real problem was some firefox dependencies not being installed inside the docker container I was testing in.
Try to initiate firefox and check if it returns an error.
As Nico and jay have stated you need to check the logs to see the details of the error. As you might use different systems, you can specify the path where the log is stored (i.e. "/tmp/geckodriver.log").
from selenium import webdriver
firefox_options = webdriver.firefox.webdriver.Options()
driver = webdriver.Firefox(log_path="/tmp/geckodriver.log",
options=firefox_options)
In my particular case, what the log said was:
Error: no DISPLAY environment variable specified
That was resolved adding in the options the headless mode before starting the driver. With the line:
firefox_options.set_headless()
I was able to fix this by running my tests with Xvfb. I was running them on a remote server.
I was using Jenkins so I checked the box that looked like this:
Credit to https://www.obeythetestinggoat.com/book/chapter_CI.html
in my case, I was running test cases as root
geckodriver.log
1576076416677 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofilenCbl2e"
Running Firefox as root in a regular user's session is not supported. ($HOME is /home/seluser which is owned by seluser.)
1576077143004 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile7wpSQ7"
1576077143689 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1576077143689 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: telemetry
1576077143689 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1576077143689 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: about:reader*
1576077145372 Marionette INFO Listening on port 35571
1576077145423 Marionette WARN TLS certificate errors will be ignored for this session
1576077200207 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofilenhoHlr"
Running Firefox as root in a regular user's session is not supported. ($HOME is /home/seluser which is owned by seluser.)
i could get around by
cd /home
chown -R root seluser
i woundnt say its correct but it got my job done

Is selenium 3.12 and geckodrvier 0.21.0 are compatible and stable, all tests gets skipped on linux machine

Platform details:
geckodriver 0.21.0 , Firefox: 60, Selenium: 3.12, cent Os 7
When i ran it using mvn it starts successfully:
geckodriver INFO Listening on 127.0.0.1:14185
Marionette INFO Listening on port 284135
Tests run successfully on windows machine however when running the same on CentOs 7, tests gets skipped.
I observed All tests get skipped as the GUI of Firefox gets closed after some time with below info and error on cmd console:
INFO: org.openqa.selenium.WebDriverException: java.io.IOException:
unexpected end of stream on Connection{localhost:33365, proxy=DIRECT
hostAddress=localhost/12 6.10.0.1:258107
[ERROR] java.net.ConnectException: Failed to connect to
localhost/127.0.0.1:2285
/bin/sh: line 1: 8780 Killed
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64/jre/bin/java
if(platform.equalsIgnoreCase("linux")) {
FirefoxOptions options = new FirefoxOptions();
DesiredCapabilities desiredCap = DesiredCapabilities.firefox();
profile.setPreference("browser.download.dir",System.getProperty("user.dir")+ File.separator + "target");
System.setProperty("webdriver.gecko.driver", "/path/geckodriver/geckodriver");
System.setProperty("webdriver.firefox.bin","/usr/bin/firefox/firefox");
desiredCap.setCapability(CapabilityType.PLATFORM_NAME,Platform.LINUX);
desiredCap.setCapability("webdriver.firefox.profile",DesiredCapabilities.firefox());
driver = new FirefoxDriver();
}
I have spent so much time on this but unable to find the root cause of this.
Using maven surefire plugin 2.19.1.
Kindly help me on this i am really stuck here.
As per the documentation below the combination of the binaries which you have mentioned in your question (Selenium v3.12 / GeckoDriver v0.21.0 / Firefox v60) are compatible and stable as follows:
This error message...
INFO: org.openqa.selenium.WebDriverException: java.io.IOException: unexpected end of stream on Connection{localhost:33365, proxy=DIRECT hostAddress=localhost/12 6.10.0.1:258107
[ERROR] java.net.ConnectException: Failed to connect to localhost/127.0.0.1:2285
...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowser i.e. Firefox Browser session.
As you have mentioned about using GeckoDriver v0.21.0 there is no need to mention the setProperty with webdriver.firefox.bin. You need to ensure that Mozilla Firefox is installed at the default location for each system.
Solution
As per your code trials though you have created and configured the FirefoxOptions Class and DesiredCapabilities Class objects, you havn't passed them during initializing the WebDriver.
If your usecase requires the FirefoxOptions Class and DesiredCapabilities Class objects you need to pass them during initializing the WebDriver and Web Browser.
If your usecase does not requires the FirefoxOptions Class and DesiredCapabilities Class objects you need to remove them.
Your code looks fine to me.
Check for all the processes being used in your automation, make sure multiple processes are not running. Most importantly for following:
ps -ef|grep firefox
ps -ef|grep geckodriver
ps -ef|grep java
Close if multiple process are running
Check for any error logs:
sudo vi /var/log/messages
Find for Kill or ERROR.This should help where it is breaking.

Error : 1506741262570 Marionette INFO Listening on port 2828 using Selenium

I want to open Google using Selenium using Firefox. The firefox version I am using is 52.3.0 (64-bit). I am trying in this way;
System.setProperty("webdriver.gecko.driver","C://geckodriver-v0.19.0-win64_2//geckodriver.exe"); // Setting GECKODRIVER
WebDriver WD = new FirefoxDriver();
WD.get("http://www.google.com");
But on running the program, it goes to sleep and the output comes as;
1506741259735 geckodriver INFO geckodriver 0.19.0
1506741259744 geckodriver INFO Listening on 127.0.0.1:31605
1506741260475 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\SPERID~1\\AppData\\Local\\Temp\\rust_mozprofile.viiF05x2u2Ct"
1506741262570 Marionette INFO Listening on port 2828
What's wrong here? I am unable to understand that why it is working as?
Use this to define the Firefox version you want to use.
Most of the issue I have faced trying Selenium is around version issues, with no clear messages or info on which versions are compatible.
System.setProperty("webdriver.firefox.bin", "/path/to/another/firefox/dot/exe");
Assuming you are using the latest Selenium-Java client v3.6.0 and geckodriver v0.19.0, while mentioning the absolute path of the geckodriver.exe you need to use either the single forward slash (/) or the escaped back slash (\\) as follows:
System.setProperty("webdriver.gecko.driver", "C:/Utility/BrowserDrivers/geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("https://stackoverflow.com");
System.out.println("Application opened");
System.out.println("Page Title is : "+driver.getTitle());
driver.quit();
I believe the problem is the Firefox version.
I downloaded Firefox ESR (52.3.0) for use with Selenium IDE, but when I used WebDriver it was also automatically using the ESR version of Firefox and failing in the way you describe.
When I uninstalled Firefox ESR version, WebDriver automatically used Firefox 55.0.3 and it worked fine.
Edit: I decided I still wanted ESR, so I re-installed it and changed the default install path from "C:\Program Files\Mozilla Firefox" to "C:\Program Files\Mozilla Firefox ESR" therefore Selenium WebDriver couldn't find it easily and used the newer version of Firefox.
Try setting the Marionette capability to true,
FirefoxOptions options = new FirefoxOptions();
options.setCapability("marionette", true);
WebDriver WD = new FirefoxDriver(options);

selenium 2.53.1 isnot working for firefox 47.0.1

I am getting an error while using
windows 10
selenium 2.53.1
Firefox 47.0.1
I tried using selenium 2.53 with Firefox 46.0.1 as well as 46.0, where I cannot open any URL but can launch Firefox browser.
The error I'm getting is:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect
to host 127.0.0.1 on port 7055 after 45000 ms.
you can use marionette driver which i recently used. You need to download and rename it to wires. you can download from the following link
https://github.com/mozilla/geckodriver/releases
below is the code you need to write.
System.setProperty("webdriver.gecko.driver", "G:\\ravik\\Ravi-Training\\Selenium\\Marionette for firefox\\wires.exe");
WebDriver driver = new MarionetteDriver();
driver.get("https://www.google.co.in/webhp?hl=en&sa=X&ved=0ahUKEwjdgc21jJHOAhVCvY8KHZ4aCdcQPAgD");
System.out.println("marionette working fine....");

ChromeDriver blocks and does not fail after unexpected Alert box

I am running selenium-server-standalone-2.17.0 (for IE and Firefox) and ChromeDriver 18.0.1022.0 (standalone) on a test box (Windows 7 64bit) which I use to run Java selenium tests against.
For some reason, when running my tests against ChromeDriver, the first time it encounters an unexpected Alert box, it blocks idefinitely and the ChromeDriver log says
WARNING: Executing: executeScript
I configured ChromeDriver using the guide http://code.google.com/p/selenium/wiki/ChromeDriver and set the timeout of all the drivers with
webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
Update:
I figured out how to initialize the remote ChromeDriver in a clean way with
URL url = new URL("http://192.168.1.15:4444/wd/hub");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
Webdriver chromeDriver = new RemoteWebDriver(url, capabilities);
this ran best with the URL pointing to a selenium-server running chromedriver in a child process. You can make selenium-server run the ChromeDriver by starting it like this:
java -jar C:\selenium-server.jar -Dwebdriver.chrome.driver=C:\path\to\chromedriver.exe
I still have the same problem with Chrome getting stuck at the unexpected Alert box, but the selenium log gave me at bit more info:
INFO - Done: /session/1328623219287/element/253/click
INFO - Executing: [execute script: return !!document['readyState'];, []] at URL: /session/1328623219287/execute)
Still have no idea what is causing this... can anyone help?
This is how I initialize ChromeDriver:
System.setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY,
"PathToWhereChromeDriverIsAvailable");
ChromeDriverService service = ChromeDriverService.createDefaultService();
ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
ChromeDriver cd = new ChromeDriver(service, options);
With the Alert() i have just plain guess - probably it hangs out while executing the script - so basically you are not waiting for page to load, but for script to end executing. However, I do not have solution for this...

Categories