java - Selecting a WebElement With a Fluid ID? -


i have application trying test webdriver. on 1 page, user selects data source , other options , clicks next. when user clicks next, presented page has list of documents must upload prior submitting request.

on page documents must upload attempting names of documents , compare them spreadsheet has list of required documents based on data source user chooses.

here problem, trying document names off website. first tried

string docone = driver.findelement(by.xpath(/html/body/div[2]/div/div[2]/div/div[4]/div[2]/div/div/div/div/div[2]/div/div/div/h5)).getattribute("textcontent").tostring(); system.out.println(docone); 

when run this, cannot find element.

i tried following:

string docone = driver.findelement(by.xpath("id('41027')/div[1]/h5")).getattribute("textcontent").tostring(); system.out.println(docone); 

when ran this, not find element, manually tested , found every new request has new id, though first xpath tested not change.

my question is, how work? since element changes everytime run test?

i apparently had brain flatulence morning.

when automation clicks next documents page page scrolled way bottom , top elements apparently cannot found. put long delay 30 seconds , scrolled top of page manually , test passed first xpath mentioned.

so selected web element visible , told send keys page command, , worked swimmingly.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -