I am following a clip on using Selenium:
- Installed the latest version of Python
- pip install selenium
- added WebDriver.jl (I use Atom).
- added PyCall.jl (again, via Atom)
- installed chromedriver
Now, the following creates an error:
browser = init_chrome()
I get the error:
“UndefVarError: init_chrome not defined”
What am I doing wrong? What have I missed?
I tried re-installing Python using Conda (I manually installed the latest version of Python prior to that). I also used Conda to add selenium. But, I still get the same problem.
This video seems outdated (it refers to an older version of WebDriver.jl).
I don’t think
init_chrome is a method/function of WebDriver.jl.
Consider the manual here
It seems you need to run selenium on docker (or similar) for this to work.
If you want a solution via PyCall (without WebDriver.jl), you may consider the following snippet:
I note that WebDriver.jl likely has limited functionality compared to, e.g., the python library for selenium
tmpd = mktempdir()
webdriver = pyimport("selenium.webdriver")
#you will need to download chromdriver for the next call to work
#also chromedriver.exe needs to be in PATH (windows environment variable) for this to work
#also the chrome version you have needs to match the chromedriver version
driver = webdriver.Chrome()