Thursday, 21 June 2018

Waiting the page move to other page to check the URL

When I was doing an automation testing, there is a situation that two page has an almost same element and layout, and might be the Xpath and title are the same, so how to make sure that the page has already changed.

In my opinion, I'd like to use the percent of keywords of  URL to make sure that the page has changed.

Such as I am now at the PropertiesOwnerPage

Then at the search box, I enter the "Morgan House" and then click the search button
All the layout are almost same and it is now not easy to make sure that the page is really moved to the search result Page. So I use way to figure it out.

            BtnSearch.Click();
            while (!_driver.Url.Contains("SearchString"))
            {
                Thread.Sleep(200);
            }
            return new SearchResultPage();

that means then the BtnSearch clicked, until the page goto the search result page, or it will wait for 200ms and then check the if URL  has changed. if it has changed, then move to SearchResultPage

No comments:

Post a Comment

What to do to make sure HTML Table is loaded completely if implicit and explicit wait are not working.

These days I was working on a project, to implement the delete function of a listing. Such as below: Actually,  every time deleted the it...