I am scraping a website using python selenium. My code was working absolutely file on my local server, but in pythonanywhere not :c
My inital configuration is:
options.add_argument('--headless')
#options.add_argument('--ignore-certificate-errors-spki-list')
#options.add_argument('log-level=3')
options.add_argument('window-size=1920,1080')
options.add_argument("--incognito")
options.add_argument("--disable-gpu")
options.add_argument('--no-sandbox')
#options.add_argument("-disable-software-rasterizer")
self.driver = webdriver.Chrome(options=options)
self.wait = WebDriverWait(self.driver,20)
And the errors are:
ExecptionType: <class 'selenium.common.exceptions.WebDriverException'>
ARCHIVE: /home/cheap404price/bot-discounts/bot.py
LINE:269
ERROR: Message: unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
(Session info: headless chrome=90.0.4430.212)
Traceback (most recent call last):
File "/home/cheap404price/bot-discounts/bot.py", line 269, in iniciar_bot
self.driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
File "/home/cheap404price/bot-discounts/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 634, in execute_script
return self.execute(command, {
File "/home/cheap404price/bot-discounts/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/cheap404price/bot-discounts/venv/lib/python3.9/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: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
(Session info: headless chrome=90.0.4430.212)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/cheap404price/bot-discounts/bot.py", line 328, in <module>
Bot().iniciar_bot(url)
File "/home/cheap404price/bot-discounts/bot.py", line 305, in iniciar_bot
self.url = self.driver.current_url
File "/home/cheap404price/bot-discounts/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 669, in current_url
return self.execute(Command.GET_CURRENT_URL)['value']
File "/home/cheap404price/bot-discounts/venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/cheap404price/bot-discounts/venv/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidSessionIdException: Message: invalid session id
[formatted by admin]