user-data-dir not working anymore on selenium with chromedriver 90 - selenium

user-data-dir not working anymore on selenium with chromedriver 90
already tried to reinstall chrome, redownload chromedriver and adding:
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
not working on win10 laptop and on win 8.1 laptop
I've not touched anything and yesterday was working. HELP ME PLEASE!
edit: when i try to run my pyhton script on windows 8.1 it says that chrome can't write or read in a directory (i'm italian, it's a translation) but when i run on win10 it says "Exception has occurred: WebDriverException
Message: unknown error: DevToolsActivePort file doesn't exist"
EDIT2: If you have one single script it works by adding chrome_options.add_argument("--remote-debugging-port=9292")
If you have to run more than one change --user-data-dir=profile to --user-data-dir=C:\Users\myuser\Desktop\profile

No promises that this will work for you, but my code did the same thing overnight and what fixed it was explicitly setting the remote debugging port:
options.add_argument("--remote-debugging-port=9292")
Seems to be either a Chrome 90 or Chromedriver issue/feature.

Related

Seleniumbasic: Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed

I have the known problem (chrome is no longer running so ChromeDriver is assuming that Chrome has crashed), but I use Seleniumbasic(windows and excel vba). Could someone tell me which SetPreferences to use? Or some other solution to this problem in vba. I have found solutions for pyton and java but cant find anything for vba.

Selenium `WebDriverException: Message: unknown error: unable to discover open window in chrome`

Hi.
I am using selenium to control chromium in order to do some low-effort scraping. I am also on linux, inside the crostini container for chromeOS, which complicates things a bit. I get this code running on windows just fine, but inside the linux container, I can't get it to work. It always opens a window (chromium presumably), which then quickly closes and the program fails with the message WebDriverException: Message: unknown error: unable to discover open window in chrome.
relevant code (w/o imports)
options = webdriver.ChromeOptions()
options.add_argument('--mute-audio')
options.add_argument('--log-level=3')
driver = webdriver.Chrome(options=options)
installed packages
chromium
chromium --version: Chromium 102.0.5005.61 built on Debian 11.3, running on Debian 11.3
chromium-driver
chromium-driver --version: ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005#{#819})
Does anybody know how to fix this? I can't seem to find any solution to that by googling...

selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service geckodriver error using Selenium GeckoDriver & Firefox browser [duplicate]

This question already has answers here:
Selenium Python code that used to work now opens browser and then gets stuck in "data:,". Says "chrome not reachable"
(3 answers)
Closed last year.
imports...
browser = webdriver.Firefox()
browser.get('http://google.com')
I'm trying to execute the code above. It used to work and now it doesn't: Firefox doesn't even open. The code, Python, Selenium and all the other libraries, Firefox and geckodriver have not changed at all since when it worked. What changed was that I installed many new apps in my Windows PC, such as: Plex media server, Eclipse, Java development kit and many Java libraries, Maven, Postgresql and Git.
Here's all that appears in the terminal when I run:
Traceback (most recent call last):
File "C:\Users\hougy\OneDrive\Documentos\plij\seleniumtest.py", line 26, in <module>
browser = webdriver.Firefox()
File "C:\Users\hougy\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 175, in __init__
self.service.start()
File "C:\Users\hougy\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\common\service.py", line 108, in start
raise WebDriverException("Can not connect to the Service %s" % self.path)
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service geckodriver
When it was working, the message "1636932662336 geckodriver INFO Listening on 127.0.0.1:49684" appeared in the geckodriver.log, followed by a lot of stuff. Now, only that message appears. Each time, the code before "geckodriver INFO" and the port are different.
I was thinking that maybe the problem was that they all try to use localhost. So I made sure Plex and Postgre were not running. I also tried a solution that wanted you to make sure 127.0.0.1 was mapped to localhost in a Windows file.
I also tried many of the common selenium solution such adding some options, making sure the geckodriver is found and updating everything.
If I run the same code in another PC that's also in my home, it works perfectly, but I need to make it work in this PC.
It's been more than a year since I need to use Selenium and I was working with Chrome and chromedriver before, but I had problems and had to waste a lot of time debugging all the time, probably because Chrome update frequently. So recently, when I couldn't solve the latest problem, I found out I could use Firefox just for this and configure it to never update. I thought my pain was over, but here I am again. Here's the problem I couldn't fix last time with chromedriver:
Selenium Python code that used to work now opens browser and then gets stuck in "data:,". Says "chrome not reachable"
This error message...
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service geckodriver
...implies that your program is unable to start the GeckoDriver Service.
Solution
Use the key executable_path to point to the downloaded matching version of the GeckoDriver as follows:
browser = webdriver.Firefox(executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
browser.get('http://google.com')
However, your main issue seem to be the incompatibility between the version of the binaries you are using.
Solution
Ensure that:
GeckoDriver is updated to current GeckoDriver v0.30.0 level.
Firefox is updated to current Firefox Version 94.0.1 level. (as per mapping between geckodriver releases, and required versions of Selenium and Firefox).
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test as non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
References
You can find a couple of relevant detailed discussions in:
Python Selenium "Can not connect to the Service %s" % self.path in linux server
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service error using ChromeDriver Chrome through Selenium Python
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chromedriver.exe while opening chrome browser

chromedrive.exe has stopped working

Am running the automation suite on the below configuration
Selenium: 3.11.0
Chrome: 65.0.3325.181
Chromedriver: 2.37
JDK: 1.8
OS: Windows 7 Enterprise(64 -bit)
On mid of the execution am getting an error as Chromedriver.exe has stopped working and the execution got stopped.
To resolve this, have tried with different version of selenium and chromedriver. Couldn't able to resolve the issue.
Issue Image
ChromeDriver Log: Log
Update:
Am getting this error whenever my code triggers the driver.get(URL) or driver.navigate().to(URL) command. FYI, am not sure this gonna help or not. Just to give more insight, my code will access two sites, in that one is https and another one is http. Am getting the exception whenever it access the http site.

Selenium WebDriver - FirefoxDriver error: Failed to start up socket within 45000

I'm getting this error:
tests.IntegrationTests.Selenium.RegisterAndLogin (TestFixtureSetUp):
SetUp : OpenQA.Selenium.WebDriverException : Failed to start up socket within 45000
when I carry out the following in my code:
using System;
using System.Text;
using NUnit.Framework;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium;
namespace ekmProspector.tests.IntegrationTests.Selenium
{
[TestFixture]
public class RegisterAndLogin
{
private IWebDriver driver;
[TestFixtureSetUp]
public void Init()
{
driver = new FirefoxDriver();
}
}
Can't get much simpler really, but the error is fatal. Any ideas?
Solution is as easy as pie :)
Right Click on your .Net (C#) Project and select 'Manage NuGet Packages ...' option, as shown below:
Then select Selenium specific packages, they need updated so update them.
The updated packages will be updated automatically.
It works for me.
I got this working in the end, I removed all the package sub-folders which were added by NuGet when installing WebDriver and decided to added these manually. Created a 'lib' folder, then unzipped the selenium binaries into that folder. Then added references to all the binaries. Seems to be fine now.
Versions
FF v48
Selenium Webdriver v2.53.1
Windows 7 (x64)
.Net 4.0 and .Net 4.5
Trying the fixes
As per #jaffa I manually added the following refereces and got the problem:
WebDriver.dll v2.53.1
WebDriver.Support.dll v2.53.1
I then unreferenced them and followed #HassanRahman and used NuGet:
WebDriver.dll v2.53.1
WebDriver.Support.dll v2.53.1
Still same error.
OpenQA.Selenium.WebDriverException : Failed to start up socket within 45000
Troubleshooting
I had a hunch and decided to downgrade from targeting .Net 4.5 to .Net 4.0 (Full not client profile) and the error changed to:
An unhandled exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll
Additional information: Cannot find Firefox binary in PATH or default install locations. Make sure Firefox is installed. OS appears to be: Vista
I wondered if this is why people who reinstalled FireFox got it to work again?
Somewhere there has to be a set of Registry Keys or an Environment Variable to find FireFox's ApplicationStartupPath. You can see some of those paths in this ProcessMonitor trace:
In the screenshot above you can see the app (AstrobLabe) I'm using running this line of code:
using (IWebDriver driver = new FirefoxDriver(ffprofile))
It causes a search for FireFox v48 and its looking in the wrong directory:
C:\Program Files (x86)\Mozilla FireFox\FireFox.exe
On my system FireFox is installed in:
C:\Program Files (x86)\Mozilla\Firefox\FireFox.exe
Anyway finding and correcting this issue (Cannot find Firefox binary in PATH or default install locations) is for someone else to fix, I just copied the Firefox directory to Mozilla FireFox.
But then it goes back to the original error:
An unhandled exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll
Additional information: Failed to start up socket within 45000 milliseconds. Attempted to connect to the following addresses: 127.0.0.1:7055
Solution
Then I came across this answer which says that FireFox v46 works with Selenium 2.53:
Which Firefox version is compatible with Selenium 2.53.0?
When I downgraded I saw that FFv46 installs to:
C:\Program Files (x86)\Mozilla FireFox\FireFox.exe
So check if your FF install is in this location - which based on the ProcessMonitor Trace Selenium cant find:
C:\Program Files (x86)\Mozilla\Firefox\FireFox.exe
I solved this by completely removing firefox and all profiles and reinstalling.
I found that I was able to to fix this problem in Firefox Selenium by updating my Selenium packages in NuGet.
But it still leaves you with the problem of manually updating the Chrome and IE drivers if similar problems arise.
I also faced the problem while running the the test in NUnit. I found many solution to remove or degrade your Firefox.But i solved this in another way i remove all the references related to web drivers and add the upgrade web driver to the Solution.
In my application the webdriver version was 2.24 so i replaced with 2.43 and now my test are running fine.
For anyone finding this question more recently (2015-02-27), there seems to be an open issue with compatibility with Selenium and Firefox 36:
https://code.google.com/p/selenium/issues/detail?id=8399
You can download Firefox 35 here: http://www.filehippo.com/download_firefox/59889/
I had this issue with latest version of both Firefox (42) and Selenium (2.48.2). Uninstalling and re-installing (via Nuget) fixed the issue for me.
I found that running an older version of resharper (9.2) failed to work with the latest nunit and that caused selenium to timeout.
The temporary solution was to disable resharper (Tools -> Options -> Resharper -> Disable), the permanent solution is upgrading resharper.
None of the previous answers clearly state that specific versions of Selenium WebDriver work with specific versions of Firefox. This SO question tells us that the Webdriver/Firefox compatibility matrix is here.
The other thing worth stating is that Firefox tends to update itself more-or-less automatically when new versions become available, depending on settings. Since Webdriver does not update itself automatically, this opens up the possibility that the Webdriver/Firefox compatibility will unexpectedly break and your test scripts will stop running when Firefox updates itself to a version that is not supported by your Webdriver version. I suspect that the answers above that instruct users to re-install Webdriver using Nuget simply pick up the newest Webdriver which works with the newest Firefox that just installed itself on your machine.
To prevent Firefox from upgrading itself, click on the menu button in Firefox (three horizontal bars, upper-right corner), choose "Options", choose "Advanced" on the left menu, choose the "Update" tab at the top and you'll see a set of radio buttons under "Firefox updates". Choose a setting other that "Automatically install updates".
Reinstalling FF browser fixed the issue.
Which version of Selenium IDE you are using? Try downgrading the Firefox version. The release notes of selenium IDE is mentioned in below link.
https://code.google.com/p/selenium/wiki/SeIDEReleaseNotes
Hope this helps.
1) Downgrade your firefox to < 19 because if i remember correctly WebDriver 2.33 support maxim Firefox 19
2)
FirefoxProfile profile = new FirefoxProfile();
profile.Port = 9966;
Global.Driver = new FirefoxDriver(profile);
P.S. I'm using firefox 16 to not have this issue
I have same issue with selenium version 2.37.xx with Firefox browser 42.0
After updating selenium version 2.48.2 issue is fixed
I was working with on C# with WebDriver 2.53/Firefox 46. Tried reinstalling things, manually re-adding etc but downgrading Firefox to 43 fixed it for me.
Updating through "NuGet" is what helped me. Firefox 47 and Selenium Webdriver 2.53 wasn't working. Checking the selenium site, it still shows "2.53" as their latest. Checking "NuGet" though, I saw there was a "2.53.1" version available. Installing that version is what got my Firefox 47 to work again.
Error image
See the error image, I uninstalled completely and re-install version46, things solved.