Selenium find button
Hy. I have a problem with selenium IDE. I have a button in a table that I must click on.
Command: click Target: xpath=//table[@id='mainForm:dataTable']//tr[contains(., 'test1')]/td[9]/div/table/tbody/tr/td[contains(., 'Edit')]/a
When I click the button 'Find' of selenium it show's me the button 'Edit' for the开发者_开发技巧 person 'test1' in my table. So selenium finds the button, that means what I write in target must be correctly.
The problem is, if I wanna run the test, selenium says :
[error] Element //table[@id='mainForm:dataTable']//tr[contains(., 'test1')]/td[9]/div/table/tbody/tr/td[contains(., 'Löschen')]/a not found
and I don#t know why.
Please help me with this problem :)
Maybe row where this text has to be present is another than 9 ? maybe try/td[contains(., 'Löschen')]/a
if you don't have another td like this on page. Good practice will be sign in some way that element in your server script (for example add rel= or title= or just specific id=) and find that by this parameter.
Try to run test growing this xpath from none, thet you should catch a situation where exactly requested element not exists, like:
//table
//table[@id='mainForm:dataTable']
//table[@id='mainForm:dataTable']//tr
//table[@id='mainForm:dataTable']//tr[contains(., 'test1')]
//table[@id='mainForm:dataTable']//tr[contains(., 'test1')]/td
//table[@id='mainForm:dataTable']//tr[contains(., 'test1')]/td[9]
And so on, until error will appear
Maybe you have some javascripts on page that do modifications in DOM tree
精彩评论