Hi glenn, and thanks for your help.
I am sorry but I am stuck since I have got another error :( I did what you recommended
You can see the documentation for Firefox object that you're using by
starting a Python console and: from selenium.webdriver import Firefox
help(Firefox)
And now my code looks like the following one:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 | #!/usr/bin/python3.6
from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
[...]
opts = Options()
opts.add_argument('--headless')
driver = Firefox(firefox_options=opts)
with Display():
try:
driver.get('https://trends.google.it/trends/trendingsearches/realtime?geo=IT&category=s')
[...]
|
where firefox_options
should be the right argument for my Selenium installation.
But now I get the error:
File "/usr/lib/python3.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 99, in _wait_until_connectable
"The browser appears to have exited "
selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the
FirefoxBinary constructor, check it for details.
It gets raised at the line where my code says:
driver = webdriver.Firefox(firefox_options=opts)
Any kind suggestion? I have already tried to search on PythonAnywhere forums and on the web and the only hint I have is it could be caused by the location of geckodriver or something like that, what do you think?
Many thanks in advance.