Python + Selenium:是否可以通过手动单击和输入锁定浏览器?

Python + Selenium:是否可以通过手动单击和输入锁定浏览器?

问题描述:

我写了一个python硒代码,可以自动执行网站上的操作.一旦用户对登录进行身份验证,硒将接管浏览器并执行其工作.一切正常,但是,我注意到,如果用户在运行硒时意外单击任何链接上的任何内容,代码可能会失败.

I have written a python selenium code which automates actions on a website. Once user authenticates the log in, selenium takes over the browser and does its thing. Everything works perfectly fine, however, I notice that the code may fail if user accidentally clicks anything on any links while selenium is running.

有没有一种方法可以防止用户手动输入?像这样:

Is there a way to prevent manual inputs from the user? something like:

br = webdriver.chrome()
br.lock_manual_userinput()

没有这样的东西.您可以将访问权限有限的计算机专用于运行自动化,或者如果您正在运行脚本,请小心操作.

There is no such thing. You can dedicate machine/s with limited access for running the automation or just be carful if you are working while running the scripts.