0
任何人都可以幫助我將xPath轉換爲CSS選擇器嗎?我想改變的代碼是這一個:如何將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選擇器,這是我的代碼中的典型構造。如果我看到在這一個寶貴的答案,我想我可以管理我的大多數其它結構
有沒有相當於'ancestor-or-self :: * [包含(@style,'display:none')]''的CSS。 – BoltClock
我很害怕這個答案會出現:(對其他人怎麼樣?或者可能是祖先或自我的解決方法? – vali83