This is the view:
After running my code i got this error message:
element click intercepted: Element <button type="button" data-bind="click: apply.bind($data, false)">...</button> is not clickable at point (393, 361). Other element would receive the click: <div data-role="spinner" data-component="product_listing.product_listing.product_columns" >...</div>
xpath: //*[@id="container"]/div/div[2]/div[1]/div[5]/button]
The SEARCH ICON has this:
<button type="button" data-bind="click: apply.bind($data, false)">
<span data-bind="i18n: 'Search'">Search</span>
</button>
XPATH:
//*[@id="container"]/div/div[2]/div[1]/div[5]/button
And then, i click on the grid and it has this:
<td data-bind="css: getFieldClass($row()), click: getFieldHandler($row()), template: getBody()">
<div data-bind="html: $col.getLabel($row())">HISENSE 32"</div>
</td>
And XPATH:
//*[@id="container"]/div/div[4]/table/tbody/tr/td[4]
I did this:
driver.findElement(By.xpath("//*[@id=\"container\"]/div/div[2]/div[1]/div[5]/button")).click();
driver.findElement(By.xpath("//*[@id=\"container\"]/div/div[4]/table/tbody/tr/td[7]")).click();
What am i doing wrong?
CodePudding user response:
First identify the element then use java action
class to click on the element. Hope that will works for you.
Actions builder = new Actions(driver);
WebDriverWait wait = new WebDriverWait(driver,Duration.ofSeconds(10));
WebElement elementSearch = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[.//span[text()='Search']]")));
builder.moveToElement(elementSearch).click(elementSearch).build().perform();
WebElement elementItem = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//tr//td[4]")));
builder.moveToElement(elementItem).click(elementItem).build().perform();