I have the following installed on Ubuntu (Amazon EC2 t2.small):
geckodriver: 0.24.0
firefox: 68.0.1
selenium: 3.141.0
On Windows, I have:
geckodriver: 0.24.0
firefox: 67.0.4
selenium: 3.141.0
I don't know if the differing firefox versions are the problem, but I'm having trouble downloading 67.0.4 on Ubuntu (following this). I get the extracted firefox folder to /usr/bin/firefox but when I run firefox -v
it gives me Command 'firefox' not found
, but that's another issue.
I'm running the following block of code:
share_url = ( driver.current_url )
...code here...
# scroll down a couple times
for _ in range(4):
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(1)
The logic is the exact same across versions. It was also working earlier.
This fails on Ubuntu with the below errors, and works just fine on Windows.
Traceback (most recent call last):
File "/home/ubuntu/cashmuny/tiktok/main.py", line 882, in <module>
compilationBody(language_code, directory, clips, len(channels.channels[language_code]), 45, record_ids, get_vids = g
et_vids, min_video_size=min_video_size, headless=headless_compilation)
File "/home/ubuntu/cashmuny/tiktok/main.py", line 448, in compilationBody
getMediaClips(channels.LANG_TO_COUNTRY[language_code], directory, clip[0], clip[1], record_ids, min_video_size, head
less=headless)
File "/home/ubuntu/cashmuny/tiktok/main.py", line 353, in getMediaClips
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 636, in execute_sc
ript
'args': converted_args})['value']
File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_r
esponse
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchWindowException: Message: Browsing context has been discarded
Traceback (most recent call last):
File "/home/ubuntu/cashmuny/tiktok/main.py", line 844, in <module>
compilationBody(language_code, directory, clips, len(channels.channels[language_code]), 45, record_ids, get_vids = get_vids, min_video_size=min_video_size)
File "/home/ubuntu/cashmuny/tiktok/main.py", line 427, in compilationBody
getMediaClips(channels.LANG_TO_COUNTRY[language_code], directory, clip[0], clip[1], record_ids, min_video_size)
File "/home/ubuntu/cashmuny/tiktok/main.py", line 283, in getMediaClips
share_url = ( driver.current_url )
File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 669, in current_url
return self.execute(Command.GET_CURRENT_URL)['value']
File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
**selenium.common.exceptions.WebDriverException: Message: Failed to decode response from marionette**