Forums

from webdriver_manager.firefox import GeckoDriverManager no module

I able to import selenium but when it add from webdriver_manager.firefox import GeckoDriverManager, it return

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named webdriver_manager.firefox

That sounds like you're using a different version of Selenium than the one for which you are writing your code.

Looking at your account, I can see that you're on a pretty old system image (essentially the version of the operating system that your account uses). With the latest one, plus our new virtualization system, you'd be able to use the most recent version of Selenium, and you'd also be able to use Chrome in headless mode (which is much better and faster than the version of Firefox that we have installed).

However, there are some risks in switching you to the newest system image; because of the changes to the point releases of Python (eg. 3.5.0 will become 3.5.9), any virtualenvs you have might break -- and if you're not using virtualenvs, the pre-installed Python modules will be upgraded so that might break any code you have that relies on the old installed versions.

Let us know if you'd like us to switch you over.

I knew that I am with an old system image as I have been with PAW for 4 to 5 years and plan to continue to run my current ongoing project with this account. I would try not to upgrade to avoid any code-breaking as long as the current selenium able to serve me.

With my current selenium, I encounter error

NoSuchElementException: Message: u'Unable to locate element: {"method":"xpath","selector":"//*[@id=\'searchpopbox\']"}' ; Stacktrace: 
    at FirefoxDriver.findElementInternal_ (file:///tmp/tmpjVcHQR/extensions/fxdriver@googlecode.com/components/driver_component.js:8444)
    at FirefoxDriver.findElement (file:///tmp/tmpjVcHQR/extensions/fxdriver@googlecode.com/components/driver_component.js:8453)
    at DelayedCommand.executeInternal_/h (file:///tmp/tmpjVcHQR/extensions/fxdriver@googlecode.com/components/command_processor.js:10456)
    at DelayedCommand.executeInternal_ (file:///tmp/tmpjVcHQR/extensions/fxdriver@googlecode.com/components/command_processor.js:10461)
    at DelayedCommand.execute/< (file:///tmp/tmpjVcHQR/extensions/fxdriver@googlecode.com/components/command_processor.js:10401)

My code in PAW as below. I have success when I try with Chrome webdriver on my laptop. So my xpath is definitely correct.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

profile = webdriver.FirefoxProfile()
profile.set_preference('browser.download.folderList', 2)
profile.set_preference('browser.download.manager.showWhenStarting', False)
browser = webdriver.Firefox(profile)
url = 'https://www.abc.com/index.php?tpl=th1_search_ajax'
browser.get(url)
time.sleep(15)
a = browser.find_element_by_xpath("//*[@id='searchpopbox']")
print a

Anything I can make eliminate the error and make it work with current selenium ?

@vinasia Maybe contact support@pythonanywhere.com and we can think about some migration path for you. We won't be able to support old system images indefinitely.

I have email to support@pythonanywhere.com. I would prefer just to make the current selenium work to my purpose at this moment.

Thanks, we've received your email -- let's keep our conversation there.