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

select on text attribute that contains ',' gives server error #24

Open
magowiz opened this issue Jul 18, 2022 · 0 comments
Open

select on text attribute that contains ',' gives server error #24

magowiz opened this issue Jul 18, 2022 · 0 comments

Comments

@magowiz
Copy link

magowiz commented Jul 18, 2022

I was testing mine app that has a list of widgets of OneLineListItem, to know which one to click I choose to select by text it contains,
in my case it is a location in this format; Country, City, so for example "Argentina, Buenos Aires"

The problem with telenium is that if I try this xpath locator:
'//OneLineListItem[@text="Argentina, Buenos Aires"]' I got server error:

> select: ('//OneLineListItem[@text="Argentina, Buenos Aires"]',)
Traceback (most recent call last):
  File "/home/magowiz/.virtualenvs/holiday/lib/python3.10/site-packages/telenium/client.py", line 36, in __call__
    return response["result"]
KeyError: 'result'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<console>", line 1, in <module>
  File "/home/magowiz/.virtualenvs/holiday/lib/python3.10/site-packages/telenium/client.py", line 60, in wait_click
    if self.wait(selector, timeout=timeout):
  File "/home/magowiz/.virtualenvs/holiday/lib/python3.10/site-packages/telenium/client.py", line 50, in wait
    matches = self.select(selector)
  File "/home/magowiz/.virtualenvs/holiday/lib/python3.10/site-packages/telenium/client.py", line 38, in __call__
    raise TeleniumHttpException(response["error"]["message"])
__main__.TeleniumHttpException: Server error

A workaround that I find is to avoid using comma in attribute text matching rule, using this one:
'//OneLineListItem[@text~="Buenos Aires"]', this is ok for me because in search field I already insert whole location and there should not be other Buenos Aires in Argentina.

Is there a way to escape comma properly before sending xpath to telenium?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant