RefreshDomTree seems not work

2 posts, 0 answers
  1. Ariel
    Ariel avatar
    1 posts
    Member since:
    Jul 2011

    Posted 12 Mar 2014 Link to this post


    I have a problem in a scrip test, so basically the scripts is:

    1:  foreach(HtmlControl e in searchResultsList) {
    2:    HtmlControl btnShowDates = e.Find.ByAttributes("class=~btn half-btn").As<HtmlControl>();   
    3:    btnShowDateLabel = btnShowDates.BaseElement.InnerText;
    4:    if (btnShowDateLabel.Contains("Show Dates") && btnShowDates.IsVisible()){        
    5:        btnShowDates.Click();          
    6:        ActiveBrowser.RefreshDomTree();
    7:        HtmlControl btnHideDatesLabel = e.Find.ByAttributes("class=~btn half-btn").As<HtmlControl>();                    
    8:        btnHideDateLabel = btnHideDatesLabel.BaseElement.InnerText;                    
    9:        Log.WriteLine("Label :" + btnHideDateLabel + " after click on Show Dates")
    10: }

    After click in step 5, I added a RefreshDomTree(), because the label is displaying another text. For example before perform click on this element, the text is "Show Dates" and after click on it, the text is "Hide Dates". I validated that text changed well in the UI (during test execution) but when I review the log I am still reading the text previous to perform click, in this case "Show Dates" when I expected to read "Hide Dates". It sames like RefreshDomTree is not working. The test script run on FF and IE9.

    Any suggestion improve the script?



  2. Boyan Boev
    Boyan Boev avatar
    1072 posts

    Posted 17 Mar 2014 Link to this post

    Hi Ariel,

    Thank you for contacting us.

    Please elaborate a bit more on your scenario and what is the actual problem. What do you mean by it is validated OK in the UO but when you review in the log you still read the previous text?

    Give us some more detailed information (e.g. screen shots, video, log).

    You can try to make the click in step 5 a real one: btnShowDates.MouseClick(); 

    Does this help?

    Hope to hear from you soon.

    Boyan Boev
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top