Css selector for elements with style attribute

前端 未结 3 435
长情又很酷
长情又很酷 2021-01-03 10:39

I have an element with the following styles

Now I want to se

3条回答
  •  天命终不由人
    2021-01-03 11:15

    A possible solution is to select all elements with matching class name, then the first of those with the correct style attribute. You haven't said which language the test is written in, but an example in C# would be:

    IWebElement element = driver.FindElements(By.CssSelector("ul.textboxlist-bits")).First(e => e.GetAttribute("style").Contains("background-color: transparent;"));

提交回复
热议问题