Search code examples
pythonseleniumchromiumdevtools

Python Devtools blocks selenium click()


preview

So basically I can't click an element this thing pops up I'm using developer tools for mobile emulation in selenium
script will stop functioning (semi-crash) even though i close this popup manually it wont fix

driver.find_element(By.XPATH, '/html/body/div[1]/section/nav[2]/div/div/div[2]/div/div/div[3]').click()

I've Tried send_keys(Keys.RIGHT) or enter, headless mode and ...


Solution

  • So the touch function in Chrome developer tools Device emulator was blocking the selenium clicks by popping an alert up !
    Solution: Change your emulated device to no-touch mode
    Open developer-tools(F12) and then click on cell Phone icon(CTRL+SHIFT+M), on emulator panel click those 3 dots and enable Device Type now change the it from mobile to mobile(no touch)
    Image