-
Notifications
You must be signed in to change notification settings - Fork 49
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
[BUG] Finding elements by ID when ID contains dot fails #368
Comments
I'm not sure if this should be generally solved in function web_find when selector_type is ID. |
I would try escape the dots only when selector is ID at kleinanzeigen-bot/src/kleinanzeigen_bot/web_scraping_mixin.py Lines 362 to 365 in 33a43e3
for example something like: lambda: self.page.query_selector(f"#{selector_value.replace('.', '\\.')}", parent) |
So do you also think that it wouldn't be problematic to generally replace the ID in web_find function? |
I think it is ok to change it for the selector by ID. I would not do this for the other selector types. |
Please take a look at the link i provided. If the other chars are used in IDs by kleinanzeigen, i dont know. I find only the dots used in the special attributes so far. |
I applied a fix in the preview release. please try. I think the other chars are really corner cases but doesn't hurt trying to escape them. |
This seems to work, thank you. But the workaround also has to be removed: kleinanzeigen-bot/src/kleinanzeigen_bot/__init__.py Lines 828 to 830 in 33a43e3
|
✔️ Expected Behaviour
Find element with given ID when ID contains a dot.
🐞 Actual Behaviour
Function web_find do not find elemens when the selector type is ID and the selector_value contains a dot. As in https://api.jquery.com/category/selectors/ mentioned, some meta character need to be escaped with two backslashes '\'.
📋 Steps to Reproduce
Call function that uses web_find with selector_type ID and selector_value containing an dot for example.
📺 What browsers are you seeing the problem on? (if applicable)
No response
💻 What operating systems are you seeing the problem on? (if applicable)
No response
📃 Relevant log output (if applicable)
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: