在 selenium python webdriver 中使用 send_keys() 发送三个密钥 [英] To send threekeys using send_keys() in selenium python webdriver

查看:36
本文介绍了在 selenium python webdriver 中使用 send_keys() 发送三个密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在文本框中输入一个默认值为 0.00 的浮点数.但它试图附加而不是覆盖它.我尝试使用 .clear() 然后使用 send_keys('123.00') 但它仍然被附加.然后我尝试使用 send_keys(Keys.CONTROL+'a','123.00').它只更新 0.00.

I am trying to type a float number into a textbox with default value 0.00.But it tries to get appended instead of overwriting it.I tried with .clear() and then send_keys('123.00') but still it gets appended. Then i tried with send_keys(Keys.CONTROL+'a','123.00').It updates 0.00 only.

非常感谢任何帮助.

欲了解更多信息..网址:http://new.ossmoketest.appspot.com用户 ID:senthil.arumugam@mycompanyname.com -- mycompanyname = orangescape(抱歉避免垃圾邮件)现在不需要密码.单击采购订单...在表格中请新产品和新价格...自动化示例应用程序...谢谢

For more info .. URL : http://new.ossmoketest.appspot.com userid: senthil.arumugam@mycompanyname.com -- mycompanyname = orangescape (sorry to avoid spam mails) password not needed now. click purchaseorder... in the form please new product and new price... sample application for automation.. thanks

推荐答案

我在以下方面取得了不错的成绩:

I've had good results with:

from selenium.webdriver.common.keys import Keys

element.send_keys(Keys.CONTROL, 'a')
element.send_keys('123.00')

如果这不起作用,则可能与网页中的代码有关.

If that doesn't work it may have something to do with the code in the web page.

这篇关于在 selenium python webdriver 中使用 send_keys() 发送三个密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆