power_settings_new

need help in selenium web driver

by
asked
0 like 0 dislike
72 views
0 1

Hi,

I got struck in somewhere:

http://store.demoqa.com/tools-qa/?action=register

Please can you suggest how to code :

"Please enter the answer in digit"

Many thanks,
Soham

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

answered by
selected by
0 like 0 dislike
 
Best answer
0
Hi Soham,

I analyzed the pattern. You have to first identify element using xpath.

/html/body/div[1]/form/div/strong

Now, get text from that element and split string with space " ".

String[] splitStr = text.split(" ");

Now your splitStr[0] will be your first number/number in word format
splitStr[1] will be arithmetic operator (+,-,*,/)
splitStr[2] will be another number/number in word format.

Now from above you can easily find out the calculation and do sendKeys into result text box.

Hope it helps.

Related questions

add
...