Selenium driver.get() does not work - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Selenium driver.get() does not work (/thread-14726.html) |
Selenium driver.get() does not work - RvBVakama - Dec-14-2018 It seems very simple but I am new to python and I'm stumped as to why this won't work. from selenium import webdriver class my_class(object): chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe' driver = webdriver.Chrome(chrome_path) driver.get('https://google.com')I am following: https://selenium-python.readthedocs.io/getting-started.html yet the first thing I try does not work. All it does is open a new window with chrome. It does not load google. Any help appreciated :) RE: Selenium driver.get() does not work - metulburr - Dec-14-2018 You need to download and use the chrome driver https://sites.google.com/a/chromium.org/chromedriver/downloads RE: Selenium driver.get() does not work - RvBVakama - Dec-14-2018 (Dec-14-2018, 04:39 AM)metulburr Wrote: You need to download and use the chrome driver Okay thanks, do you happen to know how to import my login credentials and what not? from selenium import webdriver class my_class(object): # set chromes path chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chromedriver.exe' ## login stuff #web = Browser() driver = webdriver.Chrome(chrome_path) options = webdriver.ChromeOptions() options.add_argument('user-data-dir=C:/Users/tom/AppData/Local/Google/Chrome/User Data')Something like that I suppose. Thanks (Dec-14-2018, 04:48 AM)RvBVakama Wrote:(Dec-14-2018, 04:39 AM)metulburr Wrote: You need to download and use the chrome driver from selenium import webdriver options = webdriver.ChromeOptions() options.add_argument("user-data-dir=C:\\Users\\RvBVakama\\AppData\\Local\\Google\\Chrome\\User Data") #Path to your chrome profile w = webdriver.Chrome(executable_path="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe", chrome_options=options) w.get("http://google.com") Got it working but now it won't get() again This is the error I get [13620:13324:1214/160750.819:ERROR:cache_util_win.cc(19)] Unable to move the cache: 5 [13620:13324:1214/160750.819:ERROR:cache_util.cc(140)] Unable to move cache folder C:\Users\RvBVakama\AppData\Local\Google\Chrome\User Data\ShaderCache\GPUCache to C:\Users\RvBVakama\AppData\Local\Google\Chrome\User Data\ShaderCache\old_GPUCache_000 [13620:13324:1214/160750.820:ERROR:disk_cache.cc(168)] Unable to create cache [13620:13324:1214/160750.821:ERROR:shader_disk_cache.cc(620)] Shader Cache Creation failed: -2 Traceback (most recent call last): File "tet2.py", line 5, in <module> w = webdriver.Chrome(executable_path="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe", chrome_options=options) File "C:\Users\RvBVakama\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__ desired_capabilities=desired_capabilities) File "C:\Users\RvBVakama\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__ self.start_session(capabilities, browser_profile) File "C:\Users\RvBVakama\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "C:\Users\RvBVakama\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\Users\RvBVakama\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387),platform=Windows NT 6.1.7601 SP1 x86_64) SOLVED |