Selenium Chromedriver Opens a Blank Page Instead of Url on Linux

Chrome page opened with selenium remains blank

Thanks for your help guys, actually Guy was right, I had to specify the port:

options.add_argument('--remote-debugging-port=9222')

Now it works!

Headless Chrome in Selenium retrieves empty page (works without headless flag though)

The webpage obviously detects when running Chrome Headless through the user agent (this is different when running headless, and will literally contain HeadlessChrome). Simple solution: Specify a Chrome non-headless user agent in your ChromeOptions, e.g.

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36

Here's how to specify it through the ChromeOptions:

ChromeOptions options = new ChromeOptions()
.addArguments("--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36")
.setHeadless(true);

Python: Selenium ChromeDriver opens blank page ('data:,')

Funny enough, I realized it was because my Chrome Developer tools had become disabled. Not sure how but when I re-enabled them, it worked perfectly again. Weird.

Blank page on headless Selenium tests run with Jenkins

I tried lots of solutions but it turned out that Jenkins wasn't allowed to access the resources I needed to test. So... I couldn't solve it myself anyway. Sysadmins did.

Headless Chrome - getting blank page source

Headless Chrome should be able to handle everything the normal Chrome can do:

It brings all modern web platform features provided by Chromium and the Blink rendering engine to the command line.

(see https://developers.google.com/web/updates/2017/04/headless-chrome)

Since only the login page of a bank causes you trouble, my guess is that the security of the page detects an anomaly and decides not to serve you.

One way they can do that is by looking at the User Agent string which contains HeadlessChrome.

That said, unless you're writing integration tests for the bank, your behavior is at least suspicious. If you have a valid and legal concern, clear it with the bank first. They might take actions against you, otherwise. Blocking your IP address (which could affect many people) or asking the police to have a word with you.

Selenium doesn't open the specified URL and shows data:,

This error message...

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally
(chrome not reachable)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

...implies that the ChromeDriver instance was unable to start the Chrome Browser process.

Your main issue is the google-chrome is no longer present at the expected default location of /usr/bin/

As per ChromeDriver - Requirements the server expects you to have Chrome installed in the default location for each system:

Chrome_binary_expected_location

1 For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary. You can also override the Chrome binary location as follows:

  • A Windows OS based example:

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options

    options = Options()
    options.add_argument("start-maximized")
    options.binary_location("C:\\path\\to\\chrome.exe")
    driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe', chrome_options=options)
    driver.get('http://google.com/')

Additional Considerations

  • Upgrade ChromeDriver to current ChromeDriver v2.42 level.
  • Keep Chrome version between Chrome v68-70 levels. (as per ChromeDriver v2.42 release notes)
  • 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 @Test.


Related Topics



Leave a reply



Submit