Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Selenium Webdriver for Java, find element and continue using

  • 10-07-2017 10:20AM
    #1
    Registered Users, Registered Users 2 Posts: 5,753 ✭✭✭


    Hi, im doing a test that finds an element. However the page changes at times. How would you attempt to continue using that element?
    Tagged:


Comments

  • Registered Users, Registered Users 2 Posts: 1,424 ✭✭✭nullObjects


    Can you post some of the code for how the element appears on the webpage?
    For instance is it that the id of the object changes or just the value?

    You could write an object description using xpath that targets the element relative to another element.
    Just be aware that depending on how you write the xpath it might be brittle


  • Registered Users, Registered Users 2 Posts: 1,712 ✭✭✭Hrududu


    If part of the id is dynamic you can wildcard it out. Just make sure that the id is still unique. You can update your selector to be basically: id starts with...id ends with

    If you google you'll get the exact syntax


Advertisement