|
I am getting this error: in Ghrome dev tools, this xpath is valid and can select the desired element but seleniumbase is not happy about it. |
Replies: 5 comments 1 reply
|
@maburrub That's definitely not valid XPath. Can you show me the original line of code that generated the error? It looks like a selector that was in the middle of being converted into CSS from XPath, but it didn't quite get there. |
|
@maburrub |
|
I am sorry I did not pay attention to the difference between the original xpath and the error message. Here is the original xpath and the error message so back to my quesiton is it an invalid xpath to begin with ? or not. let me know what you think: "//div[contains(@Class,'deals_index_deal-board_column')][.//camp-text[text()='To Contact']]//camp-text[text()='deal16384687810']" [undefined]seleniumbase.fixtures.xpath_to_css.XpathException: //div[contains(@Class,'deals_index_deal-board_column')][./descORself/camp-text[text()='To Contact']]/descORself/camp-text[text()='deal16384687810'] |
|
@maburrub That's a very complex xpath. There are brackets inside of brackets, eg: |
|
Thank You. |
@maburrub
/descORself/is not a real xpath component. It's a temporary replacement ofdescendant-or-self::*/(https://developer.mozilla.org/en-US/docs/Web/XPath/Axes/descendant-or-self) for specific use in converting an xpath selector into a css selector for cases where pure javascript or jquery was necessary instead of regular selenium methods. That/descORself/should only exist within xpath-to-css conversion, and should not be found in the wild. You can avoid such problems by using CSS Selectors whenever possible.