谁能帮我将我的 xPath 转换为 CSS 选择器?我要更改的代码是这个:
String selector = "";
    if(hasBaseCls()){
        selector += " and contains(@class, '" + getBaseCls() + "')";
    }
    if(hasCls()){
        selector += " and contains(@class, '" + getCls() + "')";
    }
    if (hasName()) {
        selector += " and contains(@name,'" + getName() + "')";
    }
    if(hasStyle()){
        selector += " and contains(@style ,'" + getStyle() + "')";
    }
    if(hasVisibleOption()){
        selector += " and count(ancestor-or-self::*[contains(@style, 'display: none')]) = 0";
    }
我正在尝试更改我的框架以使用 CSS 选择器,这是我代码中的典型构造。如果我在这个问题上看到一个有价值的答案,我想我可以管理我的大部分其他结构