Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
186 views
in Test Automation by

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

1 Answer

0 like 0 dislike
by
selected by
 
Best answer
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.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...