Chrome webdriver selenium memory error- python 3

Hello I was trying to test selenium and chrome webdriver by creating a script that will open up the browser to a specific site.

Here is my code below:

import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

def open_browser(user_string):
    browser = webdriver.Chrome()
    browser.get(user_string)

def main():
    x = input("Where would you like to open the internet to? ")
    open_browser(x)

if __name__ == '__main__':
    main()

However, when I run this in the shell, a blank window opens for a few seconds then closes and I get these errors:

124:63332:1022/202611.560:ERROR:persistent_memory_allocator.cc(815)]
Corruption detected in shared-memory segment.

124:60160:1022/202621.325:ERROR:shader_disk_cache.cc(237)] Failed to
create shader cache entry: -2

I have no idea what could be causing these errors.

Upvotes: 2

Views: 6671

Answers (2)

Shoaib Akhtar
Shoaib Akhtar

Reputation: 1403

Put 'chromedriver.exe' inside script folder which is inside python folder on your installed driver(by default C://Python/script), then add C://Python and C://Python/script in path under environment variable. Follow the step here for more detail. After the setup restart once and then try your code

Upvotes: 4

Damian Jansen
Damian Jansen

Reputation: 236

It works for me. Check that you have the correct version of chromedriver in your path. Otherwise, try deleting the shadercache: ~/.config/google-chrome/ShaderCache/ (or on Windows C:\Users\YOU\AppData\Local\Google\Chrome\User Data\ShaderCache\)

Upvotes: 3

Related Questions