Chrome opens with “Data;” with selenium chromedriver
Asked Answered
K

4

7

Trying to open "Google" or any other page (website) from Chrome via selenium chrome driver in python.

The code is :

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
import time

driver = webdriver.Chrome()
driver.get('https://google.com')

However, this opens my chrome window with the specified link and "data;" tab.

enter image description here

Why that data; tab opens? How to fix it?

Using latest versions of Chrome and Chromedriver

Kaleighkalends answered 9/9, 2018 at 9:22 Comment(3)
Update the question with the error trace logsLugar
@Newcontributor there are no errors shown...Kaleighkalends
Does this answer your question? python selenium chrome webdriver giving me data; pageDietz
R
0

You don't need as much module for this just remove all of those apart from: from selenium import webdriver

And try again you will not get another tab with congaing data.

Rockbound answered 21/5, 2019 at 7:14 Comment(0)
S
0
import time

time.sleep(1)
driver.switch_to.window(driver.window_handles[1])
driver.close()
driver.switch_to.window(driver.window_handles[0])
time.sleep(1)
Schleicher answered 8/12, 2020 at 11:1 Comment(1)
Please don't post only code as answer, but also provide an explanation what your code does and how it solves the problem of the question. Answers with an explanation are usually more helpful and of better quality, and are more likely to attract upvotes.Sallyanne
N
0

I'm not sure if its the same problem, but some time ago I made an exe script to run in another PCs and in one of the PCs selenium just didn't worked with Chrome.

This is the question I posted, but the answers didn't help me, hope it works with you: Chromedriver do not open a new session, it opens a new tab in a existing session

If it doesn't work, I made a workaround to run with Firefox instead of Chrome to ensure it would work properly.

Need answered 24/6, 2021 at 22:40 Comment(0)
N
0

With selenium 4 (or newer), you can use the following code to launch a new browser, (without the Chrome is being controlled message), and then the browser navigates to Google in the same tab:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option("useAutomationExtension", False)
service = ChromeService()
driver = webdriver.Chrome(service=service, options=options)
driver.get('https://google.com')
Naphthyl answered 15/9, 2022 at 16:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.