Using selenium with weird id's
One problem i faced today was with weird id's.
A button had the id "Seat_Outward_558694241". Each time, the number "558694241" would change. Using xpath with complete dom could create brittle tests. Since xpath is basically relative position, if the button is moved outside the table ( in which it was currently residing), the test would have failed.
Solution
//input[@type='button' and @value='Seat Plan']
This is also xpath, but it would not fail as long as there is a button with caption "Seat plan".
A button had the id "Seat_Outward_558694241". Each time, the number "558694241" would change. Using xpath with complete dom could create brittle tests. Since xpath is basically relative position, if the button is moved outside the table ( in which it was currently residing), the test would have failed.
Solution
//input[@type='button' and @value='Seat Plan']
This is also xpath, but it would not fail as long as there is a button with caption "Seat plan".
Comments
Post a Comment