Reputation: 31
When running this simple code a blank page opens with 'data:,' written in the url. Chrome driver is the correct version (ChromeDriver 81.0.4044.69) and matches my GoogleChrome version (81.0.4044.122). Selenium updated also (3.141.0)
I have also added the driver's folder to the systems' PATH. Also tried with http instead of https in the url.
from selenium import webdriver
class GoogleBot:
def __init__(self):
self.driver = webdriver.Chrome(executable_path="C:\Drivers\chromedriver.exe")
driver.get("https://www.google.es/")
GoogleBot()
Upvotes: 3
Views: 5382
Reputation: 4177
In your code you have used driver
intead of self.driver
. please refer below code to resolve your issue ::
from selenium import webdriver
class GoogleBot:
def __init__(self):
self.driver = webdriver.Chrome(executable_path=r"path for chromedriver.exe")
def googleTest(self):
self.driver.get("https://www.google.es/")
self.driver.close()
if __name__ == "__main__":
GoogleBot = GoogleBot()
GoogleBot.googleTest()
Upvotes: 2