Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Unable to convert XPath Selector to CSS Selector" in seleniumbase 4.25.0 #2658

Closed
uendelbatista opened this issue Apr 3, 2024 · 2 comments
Labels
invalid usage You may need to change what you're doing

Comments

@uendelbatista
Copy link

uendelbatista commented Apr 3, 2024

Hello, when trying to use the xpath below in the recently released version, the error "Unable to convert XPath Selector to CSS Selector" is returning. I reinstalled version 4.24.12 and everything worked again

xpath_bet = f"(//span[(text()='Arsenal') or (text()='Luton')]/ancestor-or-self::div[@class='_3-Kwf']//button)[1]"

driver.uc_click(xpath_bet , by="xpath")
@uendelbatista uendelbatista changed the title Errro "Unable to convert XPath Selector to CSS Selector" in seleniumbase 4.25.0 Error "Unable to convert XPath Selector to CSS Selector" in seleniumbase 4.25.0 Apr 3, 2024
@mdmintz mdmintz added the invalid usage You may need to change what you're doing label Apr 3, 2024
@mdmintz
Copy link
Member

mdmintz commented Apr 3, 2024

That's a long & messy XPath you have there. Might not even be valid, and even if it was somehow, it would need a CSS equivalent because uc_click() requires JS, which needs selectors to be in CSS Selector format. Use a CSS Selector instead, or a valid XPath that has a CSS Selector equivalent. Not all XPaths can be directly translated into matching CSS Selectors, but all elements can be expressed via CSS Selector, so just give it a CSS Selector directly instead.

@mdmintz mdmintz closed this as completed Apr 3, 2024
@uendelbatista
Copy link
Author

Thank you very much for the quick response @mdmintz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid usage You may need to change what you're doing
Projects
None yet
Development

No branches or pull requests

2 participants