I have 2 elements that have the same attributes but shown one at a time on the page (When one is shown, the other disappears).The only difference between the two is that the element which is displayed will have the '::before' selector. Is it possible to use an xpath or css selector to retrieve the element based on its id and whether or not it has ::before
相关问题
- XPath How to retrieve the value of a table cell fr
- Selenium in Java is not finding element when using
- How to send text to the search field through Selen
- What is the difference in “find_element_by_xpath”
- WebElement.getText() function and utf8
相关文章
- scrapy爬虫数据清洗
- driver.Manage().Logs.GetLog(LogType.Browser) no lo
- CSS: style nth sibling [duplicate]
- Chrome: fake microphone input for test purpose
- Speeding up Selenium Webdriver
- Python Selenium Send Keys Giving Warning about siz
- How do I access an element with xpath with a names
- Java XPathFactory thread-safety
I bet also to try with the javascript solution above.
Since ::after & ::before are a pseudo element which allows you to insert content onto a page from CSS (without it needing to be in the HTML). While the end result is not actually in the DOM, it appears on the page as if it is - you see it but can't really locate it with xpath for example (https://css-tricks.com/almanac/selectors/a/after-and-before/).
I can also suggest if possible to have different IDs or if they in different place in the DOM make more complex xpath using above/below elements and see if it is displayed.