Skip to content

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

@magowiz

Description

@magowiz

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions