I am trying to download file from a url using selenium and Firefox on python3 but that give me an error in the geckodriver log file:
(firefox:13723): Gtk-WARNING **: 11:12:39.178: Theme parsing error: <data>:1:77: Expected ')' in color definition
1546945960048 Marionette INFO Listening on port 40601
1546945960132 Marionette WARN TLS certificate errors will be ignored for this session
console.error: BroadcastService:
receivedBroadcastMessage: handler for
remote-settings/monitor_changes
threw error:
Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource..
Stack:
remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:188:13
I use geckodriver verssion 0.22 and firefow version 65.0. Also am on UBUNTU 18 (only ssh) geckodriver is in the /usr/bin file and have all the needed right.
I have read on google that this might be because of the COPS. But I really get what the COPS are or how to do to fix them (if that is the real problem).
here my code:
from os import getcwd
from pyvirtualdisplay import Display
from selenium import webdriver
# start the virtual display
display = Display(visible=0, size=(800, 600))
display.start()
# configure firefox profile to automatically save csv files in the current directory
fp = webdriver.FirefoxProfile()
fp.set_preference("browser.download.folderList", 2)
fp.set_preference("browser.download.manager.showWhenStarting", False)
fp.set_preference("browser.download.dir", getcwd())
fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "text/csv")
driver = webdriver.Firefox(firefox_profile=fp)
page = "https://www.thinkbroadband.com/download"
driver.get(page)
driver.find_element_by_xpath("//*[@id='main-col']/div/div/div[8]/p[2]/a[1]").click()
Do you guys have any idea ?
This error message...
...implies that there was a NetworkError while attempting to fetch resource.
Here the main issue probably is related to Cross-Origin Resource Sharing (CORS)
Solution
You need to induce WebDriverWait for the desired element to be clickable and you can use the following solution:
Code Block:
Snapshot:
I got the same error. After updating the geckodriver vresion to geckodriver 0.24.0 ( 2019-01-28) worked fine for me. Try this