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

click image cant use locator src-need fix #181

Closed
qitaos opened this issue Mar 12, 2013 · 3 comments
Closed

click image cant use locator src-need fix #181

qitaos opened this issue Mar 12, 2013 · 3 comments

Comments

@qitaos
Copy link
Contributor

qitaos commented Mar 12, 2013

@rtomac @emanlove when i user click image src=xxx.jpg, there is a error message "ValueError: Element locator with prefix 'src' is not supported".
But the document is "Clicks an image found by locator.

    Key attributes for images are `id`, `src` and `alt`. See
    `introduction` for details about locating elements."

It means i can use src for locators.
Well, I checked the elementfinder.py in Selenium2Library.locators, and I add one line "'src': self._find_by_default," in init, then it works.
Can you fix this bug in next version? Tks

@qitaos
Copy link
Contributor Author

qitaos commented Mar 12, 2013

well, src and alt both have the same problem in CLICK IMAGE.

@ombre42
Copy link
Contributor

ombre42 commented Apr 12, 2013

Thank you for reporting this.
I think the problem here is that you are misunderstanding the documentation.
The key attributes refer to how the locator is used if you do not use a locator prefix.
When you use a locator without a prefix like this:
Click Image foo
Selenium2Library searches using this XPath expression:
//img[(@id='foo' or @name='foo' or @src='foo' or @alt='foo' or @src='foo')]
In other words, without a prefix, the entire locator is matched against the values of the key attributes.
This is explained in the library documentation but it could certainly be clearer.
So you should use Click Image xxx.jpg instead of Click Image src=xxx.jpg

If you want to match only alt or src, you will have to use a different prefix/strategy and not rely on the default strategy.
Do you have any suggestions on how to make the documentation clearer?

@aaltat
Copy link
Contributor

aaltat commented May 23, 2016

There has not been activity for this issue for long time and we are planning to close the old issues if they are not anymore valid ones. If you feel that this is still valid issue, could you send an update. If update is not received in a month, we will assume that this is not anymore an issues and we will close this issue.

@aaltat aaltat closed this as completed Jun 8, 2016
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

3 participants