正如标题所说,当使用方法clear
或send_keys
后,按钮得到“disabled
”,我如何使用.click()
abutton
?在
之前:
这是我打开页面时的状态url
。。。但是在我运行代码找到textbox
和replace
的值之后,元素就在我clear
它的内容之后得到{send_keys
向其写入内容。在
之后:
代码:
txt_value = driver.find_element_by_xpath('//input[@id="txtValor4"]')
txt_value.clear() #this disables the button
txt_value.send_keys(str(123,45)) #this also disables the button
我的问题是:
How can I bypass this website protection and press the
Continuar
button?
我考虑过禁用JS
,但是整个网站都依赖它来生成所需的文档。。错误的选择。在
所以我考虑使用按钮属性来模拟按钮的按下。。。只是不知道有没有可能,或者我怎么能做到。在
另一个选项是只阻止JS
,它使用inspect element
和network tools
禁用命令的按钮映射。。。在
那么有什么方法可以达到这个目的吗?在
ps:我不能给出URL,因为它需要我的登录数据。
好吧,所以你不能直接用普通的方法。Selenium WebDriver是用来模拟浏览器的实际使用的。但是,可以使用execute_script函数。(javaselenium有一个内置的JavascriptExecutor类,我假设这是python的版本。)execute_script函数允许Selenium执行人类与浏览器交互无法完成的任务。在
或者说应该有办法。希望对你有帮助。在
我可以使用
driver.execute_script("document.getElementById('txtValor4').value = 123.45")
来绕过它,将值传递到文本框中,因此按钮没有disabled
,我可以按Continue
按钮。在即使绕过这个,结果也不是预期的!我输入的值应该被某种兴趣所修正。这个值没有被修正,但是没有被修正。在
今天,询问程序的用户告诉我,每次我更改
textbox
内的值,我必须按Calculate
按钮。在因此,我可以使用以下方法来解决我的问题:
通过这种方式,税值通过利息修正,网站生成
.pdf
与我期望的值完全一致。在非常感谢所有花时间和精力来帮助我的人。在
如果您没有使用selenium和javascript的任何解决方案,那么可以使用Sikuli概念。要单击该元素,请获取“Continuar”按钮的图像并将其保存在resources文件夹中。在
相关问题 更多 >
编程相关推荐