Can anyone help me transform my xPath to CSS Selector? The code i want to change is this one:
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";
}
I am trying to change my framework to use CSS selectors and this is a typical construction in my code. If i see a valuable answer on this one i think i can manage most of my other constructions
You can change the part of it for:
so selector will be something like
a.class1.class2[name*='somename'][style*='somestyle']