Reputation: 67
I am using Robot-framework selenium2.0. In the robot test I made, it fills out a form and save it. In the form, I have to put some numeric values in some text boxes but somehow the previous\default value of 0.0 is not removed from any of the box. When I run the test normally it puts the values after 0.0. For example I want to put 50 in the box but the test puts 50 after 0.0 so it becomes 0.050 and when it switches to next text box the value becomes NaN. Here is how I am doing it,
wait until element is visible text_field
click element text_field
input text text_field 50
Is there any ascii codes that can be used to select values (ctrl+a) and delete the values first and then use input text to input values?
Upvotes: 0
Views: 1921
Reputation: 346
This may be work for you:
driver.findElement(By.id("text_field")).click()
driver.findElement(By.id("text_field")).pressKey('Ctrl' + 'A')
driver.findElement(By.id("text_field")).pressKey('Delete')
more Press Key here
Upvotes: 1
Reputation: 2793
You can try:
Clear Element Text text_field
You could also use Selenium directly:
driver.findElement(By.id("text_field")).clear();
Upvotes: 2