sen*_*569 8 python selenium webdriver
我试图在默认值为0.00的文本框中键入一个浮点数.但是它尝试获取附加而不是覆盖它.我尝试使用.clear()然后发送send_keys('123.00'),但它仍然会被追加.然后我尝试使用send_keys(Keys.CONTROL +'a','123.00').它仅更新0.00.
任何帮助都非常感谢.
有关详细信息.. URL:http ://new.ossmoketest.appspot.com userid:senthil.arumugam@mycompanyname.com - mycompanyname = orangescape(对不起,以避免垃圾邮件)密码现在不需要.点击购买订单...在形式请新产品和新价格...自动化的样品申请..谢谢
我得到了很好的结果:
from selenium.webdriver.common.keys import Keys
element.send_keys(Keys.CONTROL, 'a')
element.send_keys('123.00')
Run Code Online (Sandbox Code Playgroud)
如果这不起作用,则可能与网页中的代码有关.
除非你有自定义编辑框,否则click()应该适合你:
from selenium.webdriver import Firefox
b = Firefox()
b.get('http://google.com')
e = b.find_element_by_id('lst-ib')
e.click() # is optional, but makes sure the focus is on editbox.
e.send_keys('12.34')
e.get_attribute('value')
# outputs: u'12.34'
e.click()
e.clear()
e.get_attribute('value')
# outputs: u''
e.send_keys('56.78')
e.get_attribute('value')
# outputs: u'56.78'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27555 次 |
| 最近记录: |