-
I am currently writing a program which involves the following code:
However, when I run this code, the element cannot be located (I have checked this XPATH numerous times and I can confirm it is valid), does anybody know what the issue could be? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Either directly use a CSS Selector, or make sure your XPath class doesn't contain special characters, such as It all gets converted into CSS anyway. Because class segment order can change, a class like Therefore, |
Beta Was this translation helpful? Give feedback.
Either directly use a CSS Selector, or make sure your XPath class doesn't contain special characters, such as
:
.Your XPath class had
:
twice: Inmd:iv-text-body-m
, and indark:iv-text-grey-30
.It all gets converted into CSS anyway. Because class segment order can change, a class like
"part1 part2 part3"
gets converted into dot-notation like this:".part1.part2.part3"
.Therefore,
sb.cdp.find_element('//button[@class="iv-inline-block iv-text-body-xl iv-text-black-50 iv-font-semibold iv-cursor-pointer"]')
works because the class segments with:
were removed.