-1

I have following button to locate. It is an ant controller.

<li class="ant-picker-ok"><button type="button" class="ant-btn ant-btn-primary ant-btn-sm"><span>Ok</span></button></li>

this is located in data entry form and its XPath change depend upon the selections that we made in top part of the form. So XPath cannot use. then i tried CSS selector and it also not support.

Finally I used class name as location strategy and use move to element.

@FindBy(className = "ant-picker-ok")
public WebElement shiftEndOkBtn;

code successfully execute upto below line.

new Actions(driver).moveToElement(shiftEndOkBtn).perform(); 

clicking part us not working and throws element is not visible. But element is visible

shiftEndOkBtn.click();

This is a ant time picker(https://ant.design/components/time-picker/)Any idea to solve this issue? enter image description here

user1767083
  • 157
  • 1
  • 3
  • 10

1 Answers1

0

You are clicking the 'li' element, not the button. Try find it by XPath:

//li[@class = 'ant-picker-ok']/button