Reputation: 1
`User will search an element from the search text box, provide quantity against the element searched and click on Add button to get the data added to the table just below the selection inputs. User is allowed to add multiple records and once she/he is done with adding elements, there are certain lists from where user needs to select the appropriate records, add comments and finally click Submit button to save the data. First Screen: enter image description here Second Screen: enter image description here Third Screen: enter image description here Forth Screen: enter image description here I am sharing DOM for empty table details below: Fifth Screen: enter image description here Sixth Screen: enter image description here
//Search Medicine, Define Quantity and Add
WebElement medicine_search = driver.findElement(By.xpath("//input[@id='txt_medicine']"));
medicine_search.sendKeys("DOLO 250MG SYRUP-60ML");
WebElement define_quantity =
driver.findElement(By.xpath("//input[@id='txt_quantity']"));
define_quantity.sendKeys("20");
WebElement btn_add =
driver.findElement(By.xpath("//input[@id='btn_addprescriptions']"));
btn_add.click();
Add button click does not add data to the table below and I am stuck at this point in my script.
Upvotes: 0
Views: 40
Reputation: 1
tip: add logs or print message after click or sendkeys It will help to trace the issue
WebElement btn_add = driver.findElement(By.xpath**("//input[@id='btn_addprescriptions']"))**; **btn_add.click();
Add button is above the table **
Only If your sendKeys are not working search medicine
2.Press Enter
medicine_search.sendKeys("DOLO 250MG SYRUP-60ML");
medicine_search.sendKeys(Keys.ENTER);
Upvotes: 0