How to use Selenium Chromdriver on Android

Viewed 3957

I've written a very simple script within kivy using selenium.

from kivy.uix.button import Button
from kivy.uix.floatlayout import FloatLayout
from kivy.app import App
from selenium import webdriver

class KivyButton(App):
    def update(self,instance,*args):
        driver = webdriver.Chrome()
        driver.get('https://google.com')
    def build(self):
        self.layout  = FloatLayout(size=(300,300))
        self.mybtn=Button(text='Enter',on_press=self.update,pos=(500,300),size_hint=(.1,.1))
        self.layout.add_widget(self.mybtn)
        return self.layout

KivyButton().run()

It's basically just a button that when you click it, takes you to google. I'm using buildozer to convert/run this on my phone. I've set the dependencies as python,kivy, selenium,chromedriver,urllib3. It then pip installs these dependencies. The app will load, but this is the output when I try to run selenium.

python : PermissionError: [Errno 13] Permission Denied

From looking online, this error appears to pop up when chromedriver is not configured properly. Using this site: https://chromedriver.chromium.org/getting-started/getting-started---android it states chromedriver should work for android chrome, but in their example they use './chromedriver' so I added that within my program as well driver=webdriver.Chrome('./chromedriver') But this gave me the same error. There are multiple chromedrivers with different versions, and thus the only thing I can think of is the chromedriver version installed by buildriver is not compatible the Chrome version on my phone? But outside of this, I don't know why I am receiving this error.

2 Answers

try adding required permissions in the buildozer.spec file.

Related