I am currently using Chaquopy to implement Python code into Android Studio. However, I am having trouble initializing selenium's chromedriver in Python. Whenever I try initializing by using the line driver = webdriver.Chrome("/path/to/chromedriver.exe, options=opt)
, I either get the error "WebDriverException: Message: 'chromedriver.exe' executable may have wrong permissions" or "WebDriverException: Message: 'chromedriver' executable needs to be in PATH". So instead, I imported ChromeDriverManager and called driver = webdriver.Chrome(ChromeDriverManager().install(), options=opt)
. Running my program gives the following error:
Process: com.example.test3, PID: 20964
com.chaquo.python.PyException: ValueError: Could not get version for Chrome with this command: google-chrome --version
at <python>.webdriver_manager.utils.chrome_version(utils.py:112)
at <python>.webdriver_manager.driver.get_latest_release_version(driver.py:58)
at <python>.webdriver_manager.manager.__get_latest_driver_version(manager.py:21)
at <python>.webdriver_manager.manager.__get_version_to_download(manager.py:27)
at <python>.webdriver_manager.manager.download_driver(manager.py:36)
at <python>.webdriver_manager.chrome.install(chrome.py:28)
at <python>.login.web_scrape(login.py:57)
at <python>.chaquopy_java.call(chaquopy_java.pyx:281)
at <python>.chaquopy_java.Java_com_chaquo_python_PyObject_callAttrThrows(chaquopy_java.pyx:253)
at com.chaquo.python.PyObject.callAttrThrows(Native Method)
at com.chaquo.python.PyObject.callAttr(PyObject.java:209)
at com.example.test3.LoginWaterloo$1.onClick(LoginWaterloo.java:37)
at android.view.View.performClick(View.java:7125)
at android.view.View.performClickInternal(View.java:7102)
at android.view.View.access$3500(View.java:801)
at android.view.View$PerformClick.run(View.java:27336)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Any advice on how to overcome this error? I have seen a post that shares the same problem but could not understand the answer.