开发者

Selenium: How do you delete a character from a textbox

开发者 https://www.devze.com 2022-12-17 06:38 出处:网络
I\'m trying to simulate a user deleting a character from a textbox. This textbox fires many JS events, I\'ve had much trouble typing (or typeKey-ing) in ift because of this.

I'm trying to simulate a user deleting a character from a textbox. This textbox fires many JS events, I've had much trouble typing (or typeKey-ing) in ift because of this.

My late开发者_如何学Pythonst try was: sel.key_press(locator, 127) and sel.key_press(locator, "\177 ") but they don't work.

What's the safest way?


Use KeyPress with '\008'


I don't think that's possible with Selenium. Each modify results in a separate Type command call. So, for example, if you write "houses" and then delete the last character, it's translated with:

type(<field>, "houses")

type(<field>, "house")

with no regard of what happens at the Javascript level. If your task is to test the various methods you should use JsUnit (or FireBug).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号