Issue
I have an element with 3 classes which I need to find with selenium
<button style="padding:2px 7px; background-color:#4caeea"
class="btn btn-xs btn-custom" </button>
I could not find it with : By.classname("btn btn-xs btn-custom")
I do not want to use xpath & cssSelector . What other options do I have ?
Solution
This By.classname("btn btn-xs btn-custom")
will not work, as it contains multiple spaces which means it is combination of 3 classes.
You will have to switch to css selector or xpath , I do not know why you have mentioned that you do not want to use both of them.
However, If you are interest to use css selector :
You can try this :
By.cssSelector("btn.btn-xs.btn-custom")
If you go by precedence :
- ID
- name
- classname
- linkText
- partialLinkText
- tagName
- css selector
- xpath
Answered By - cruisepandey
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.