简体   繁体   English

Python 开发工具块 selenium click()

[英]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所以基本上我不能点击一个元素这个东西弹出我正在使用开发者工具在 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...我试过 send_keys(Keys.RIGHT) 或输入,无头模式和......

So the touch function in Chrome developer tools Device emulator was blocking the selenium clicks by popping an alert up !因此, Chrome 开发者工具设备模拟器中的触摸 function 通过弹出警报阻止了selenium点击!
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)打开开发者工具(F12)然后点击手机图标(CTRL+SHIFT+M),在模拟器面板上点击这三个点并启用设备类型现在将它从移动设备更改为移动设备(无触摸)
Image图片

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM