kivy / kivy/telenium

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

Open
#24 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
68
Forks
22
PR merge metrics
No merged PRs in 30d

Description

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 "", line 1, in
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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the select and wait flow shown in telenium/client.py, then reproduce the reported XPath using an attribute value containing a comma. Compare it with the working ~= selector and verify that the original selector returns the matching OneLineListItem without a server error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.