I have following button to locate. It is an ant controller.
Okthis 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(
解决方案
You are clicking the 'li' element, not the button. Try find it by XPath:
//li[@class = 'ant-picker-ok']/button