不允许使用复合类名-Selenium Java [英] Compound class names not permitted - Selenium Java
问题描述
我有以下按钮可以找到.它是一个蚂蚁控制器.
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>
它位于数据输入表单中,其XPath更改取决于我们在表单顶部所做的选择.因此XPath无法使用.然后我尝试了CSS选择器,它也不支持.
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.
最后,我使用类名作为定位策略,并使用move to element.
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();
这是一个蚂蚁时间选择器( https://ant.design/components/time-picker/ )有解决这个问题的主意吗?
This is a ant time picker(https://ant.design/components/time-picker/)Any idea to solve this issue?
推荐答案
您正在单击"li"元素,而不是按钮.尝试通过XPath找到它:
You are clicking the 'li' element, not the button. Try find it by XPath:
//li[@class = 'ant-picker-ok']/button
这篇关于不允许使用复合类名-Selenium Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!