Pages

Search This Blog

Sunday, July 6, 2014

How to find a sibling of a node

How to find a sibling of a node
There are many situation when we get difficulties to find the elements which do not have identification/attribute but their immediate siblings has some identification.




In above example if we want to get the text of H1 we can not use //h1 because there are more than one h1 on the page. If you see a and h1 both are siblings and children of div//[@class='title pad_btm15']
By using a sibling element's property we can find out his sibling. In above example we know id of a which is "mainContent" then we can get its sibling

Xpath:

"//a[@id='mainContent']/following-sibling::h1"


If you have more siblings with no attribute or no unique attribute like below.

then we can use the position us find out exact element using xpath:
Xpath:
Samsung Android Mobile
"//a[@id='mainContent']/following-sibling::h1[1]"

Nokia Android Mobile :
"//a[@id='mainContent']/following-sibling::h1[2]"

28 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. I got better idea in finding the sibling of a node. Please explain me the method to connect the node machine to hub machine in selenium for cross browser testing.
    Selenium Training in Chennai

    ReplyDelete
  4. This one is much helpful, Very clear explanation about the topic.

    Latest Update here: www.bestseleniumtraininginchennai.in

    ReplyDelete
  5. Selenium Testing Real Time Hands on Training in Chennai…

    Don’t always Depend on Training Institute alone.Please aware of Best Trainers too..

    http://thecreatingexperts.com/selenium-training-in-chennai/

    If You need a Best Trainer in Selenium Testing??? Then be ready for a DEMO From the Trainer MR.Karthick
    CONTACT:8122241286

    Both Classroom/Online Training is Available!!!!!!

    ReplyDelete
  6. We can learn everyday something new in software testing. Automation is a topic that covers most of the part of testing and learning testing. Thanks for sharing this valuable information with a complete explanation.

    ReplyDelete
  7. thanks for this beautiful post of blog I really liked your blog, It is very goof for freshers
    Selenium training and Institute
    Selenium Training in Marathalli
    Selenium Course in Bangalore

    ReplyDelete
  8. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.

    python Training in Bangalore | python Training in Bangalore

    ReplyDelete

  9. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.
    Advanced AWS Interview Questions And Answers, Top 250+AWS Interviews Questions and Answers 2018
    Advanced AWS Interview questions and answers | Top 110 AWS Interview Question and Answers
    Advanced AWS Training in Bangalore | Best Amazon Web Services Training in Bangalore
    Advanced AWS Training in Pune | Best Amazon Web Services Training in Pune
    Advanced AWS Online Training | Best Online AWS Certification Course in india

    ReplyDelete

  10. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.
    Advanced AWS Interview Questions And Answers, Top 250+AWS Interviews Questions and Answers 2018
    Advanced AWS Interview questions and answers | Top 110 AWS Interview Question and Answers
    Advanced AWS Training in Bangalore | Best Amazon Web Services Training in Bangalore
    Advanced AWS Training in Pune | Best Amazon Web Services Training in Pune
    Advanced AWS Online Training | Best Online AWS Certification Course in india

    ReplyDelete
  11. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post.is article.
    python training institute in marathahalli
    python training institute in btm
    Python training course in Chennai

    ReplyDelete
  12. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
    apple iphone service center in chennai | apple ipad service center in chennai | apple iphone service center in chennai | apple service center chennai |

    ReplyDelete
  13. Real Estate Investment Trust

    http://warehouster.com/reits.html

    ReplyDelete
  14. Your article is just amazing.You might be interested in:top foot pain identifier

    ReplyDelete
  15. I Love your article. You can visit my website : yt pak.com

    ReplyDelete
  16. This site helps to clear your all query. allahabad university bsc 1st year Result
    allahabad university BA 3rd year result This is really worth reading. nice informative article.

    ReplyDelete
  17. Auto Detail School is the only private licensed exclusiveAuto Detail School, in which their programs are exclusively for auto detailing. Visit here now!

    ReplyDelete