Chrome opens with "Data;" with selenium
L

11

41

I am a newbie to Selenium and trying to open localhost:3000 page from Chrome via selenium driver. The code is :

import com.google.common.base.Function;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class SeleniumTests {

    public static void main(String[] args) {


        System.setProperty("webdriver.chrome.driver", "C://chromedriver_win32//chromedriver.exe");
        WebDriver driver = new ChromeDriver();              
        driver.get("localhost:3000");
    }

}

However, this opens my chrome window with a "data;" . The chrome version is 50.0.2661.94

Any idea what is the exact issue?

Levulose answered 11/5, 2016 at 10:19 Comment(2)
what it returns if u paste in chrome localhost:3000 manually?Ornas
if someone has the same problem while using file path, do not forget to append "file:///" before the path driver.get("file:///path/to/index.html")Nickelous
W
14

Specify the protocol you are using, so instead of localhost:3000, use http://localhost:3000. If that doesn't help, see the comment here on the Chromium issue tracker.

Workbag answered 11/5, 2016 at 10:38 Comment(0)
P
4

Yes it will start with data. After data just try to give the URL.The 'data:,' URL is just the default address that chromedriver navigates to when launching chrome. So this by itself doesn't necessarily mean that anything is going wrong.

import com.google.common.base.Function;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class SeleniumTests {

public static void main(String[] args) {


    System.setProperty("webdriver.chrome.driver", "C://chromedriver_win32//chromedriver.exe");
    WebDriver driver = new ChromeDriver();              
    driver.get("https://www.google.co.in/?gfe_rd=cr&ei=KxAzV8-KEJPT8gfT0IWYAw");
}

}

It will open successfully. Reply if you have any query. Happy Learning.. :-)

Pelisse answered 11/5, 2016 at 10:58 Comment(0)
A
4

I was also getting the same issue. I updated ChromeDriver to the latest version and that fixed it.

Argolis answered 30/3, 2017 at 10:1 Comment(5)
You could at least indicate the version you updated to, so anyone interested in this can compare.Jennajenne
I am using Chrome Driver 2.28 which Supports Chrome version 55-57. Link for the downloading Chrome Driver is sites.google.com/a/chromium.org/chromedriver/downloadsArgolis
For me Chromedriver version 2.32 with chrome version 59 workedPlantagenet
It looks like they fixed it again in ChromeDriver 88.0.4324.96.Hawken
The driver version should match the browser one if you are testing locally in live mode. Sometimes upstream repo's like npm or brew fall behing, so in case download the latest-greatest here)Marquisette
B
3

Make sure you are using latest release of ChromeDriver (as for now it's 2.28). I had same problem with data:,. By mistake I've downloaded old version and got the issue with specified URL not being opened, just data:,

Bobolink answered 11/3, 2017 at 16:35 Comment(0)
G
1

I've been running in a similar situation, the fix in my case was simply to upgrade chrome webdriver to its latest version (in my case V2.27).

The cause of showing Data; instead of the real application URL was that:

WebDriver driver = new RemoteWebDriver(new URL("http://<host>:<port>/wd/hub"), desiredCapabilities);

failed to get created. Instead, driver object was holding a null value.

So after chrome driver upgrade , it had been created correctly and problem solved.

Hope this helps who's still stuck!

Gangplank answered 3/3, 2017 at 16:49 Comment(0)
L
1

If you're using Codeception, start the test with :

$I->amOnPage('/');

Laws answered 6/12, 2019 at 14:10 Comment(0)
M
1

You need to add two things to run :

First - you should use http://localhost:3000

Second - You must use debug port before creating webDriver as : options.addArguments("--remote-debugging-port=9225");

Whole Code:

    WebDriverManager.chromedriver().setup();
    ChromeOptions options = new ChromeOptions();
    options.setExperimentalOption("useAutomationExtension", false);
    options.addArguments("--remote-debugging-port=9225");
    WebDriver driver = new ChromeDriver(options);

Drop comments if you have any query

Militiaman answered 30/7, 2020 at 7:0 Comment(1)
When WebDriverManager.chromedriver().setup() is called it loads in an inbuilt chrome driver: /home/{user}/.cache/selenium/chromedriver/linux64/102.0.5005.61/chromedriver In my case I need 101 which I loaded in System.setProperty("webdriver.chrome.driver", Path.of("").toAbsolutePath().toString()+ File.separator+"Drivers"+File.separator+"chromedriver"); instead - also in my case the rest was not neededYamen
P
0

This just happened to me when using selenium grid with python and was caused by something different than the other answers suggest (in my case at least).

It turns out there was a runtime exception being raised after the driver object was being created (and connecting to chrome) but before it was being instructed to navigate to a URL. This all runs on a celery task queue so it was easy for me to miss. So if updating the chrome driver doesn't work, double check that you're navigating to a URL correctly and there's no errors etc.

For example:

driver = webdriver.Remote(
        command_executor="http://<ip>:4444/wd/hub",
    )

# a function here raised a runtime exception, causing chrome to launch
# but sit there with the default URL "data;/"

driver.get("www.google.com")
Prelatism answered 20/11, 2019 at 4:57 Comment(0)
A
0

I had this problem too. The advice I got here did not help. Eventually I figured out that putting this:

System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");

at start of my test-script, solved the problem.

Affiance answered 21/1, 2023 at 9:7 Comment(0)
T
0

My problem was just solved by adding https:// to the start of my URL.

Tomboy answered 17/3, 2023 at 8:4 Comment(0)
H
-1

just replace the "chromedriver.exe" with latest release of ChromeDriver.

Houseraising answered 5/12, 2018 at 9:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.