c# - Is it possible to select an element (drop-down value) using which contains? -
is possible select element (drop-down value) using contains?
my drop-down value of 25 characters, of i'm using
myelement.selectbytext(mytext);
// here i'm passing full text of drop-down value.
wondering possible select passing partial value of text?
please let me know. (possible c# answers helpful)
please try below code should work
webelement web = driver.findelement(by.xpath("//select")); list<webelement> lst2 = web.findelements(by .xpath(".//option[contains(text(),'<yourtext>')]")); (webelement option : lst2) { if (!option.isselected()) { option.click(); } }
Comments
Post a Comment