My code:
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--window-size=2050,2050")
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome('chromedriver',options=chrome_options)
when I ever run the code it keeps saying the following error:
TypeError Traceback (most recent call last)
<ipython-input-32-8904e7337232> in <cell line: 6>()
4 chrome_options.add_argument('--no-sandbox')
5 chrome_options.add_argument('--disable-dev-shm-usage')
----> 6 driver = webdriver.Chrome('chromedriver',options=chrome_options)
TypeError: WebDriver.__init__() got multiple values for argument 'options'
I tried the other solutions here, but I am using google Collab, I think there are extra things I should do to further fix this?
I need to understand what is the problem
You passed chromedriver
inside Chrome
constructor as a first argument, where constructor expects options
to be passed.
Remove first argument and issue would be fixed.
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--window-size=2050,2050")
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(options=chrome_options)