Contributions
Re: Wait for Xpath
it was really a good explanation.. But this is not resolving my problem.. I am taking a small piece of code to present the actual issue def Test2(): page = Sys.Browser("chrome").Page("") select = page.FindChildByXPath("//select[@id='source-select']") select.Click() wait = 1000 total_wait = 10000 for i in range(wait, total_wait): Log.Message("In for") aqUtils.Delay(wait) val = page.FindChildByXPath("//option[text()='B/S Rep']").Exists if(val == False and wait <= total_wait): Log.Message("In if") wait = wait+1000 else: Log.Message("In else") select_val =page.FindChildByXPath("//option[text()='B/S Rep']") select_val.Click() val.Click() break Here i wrote a wait mechanism of my own. I am trying to find out an element(a value in a select list). I use the variable val to store the status, where val is present or not using .Exists property. I am getting error here and the error is as follows I expect a true or false in the variable val, if true click and break the loop. Else wait for next 1 sec and so on. .Exists behaves in a wired way. At times it supports and sometimes it wont. This is the case with click(), hover etc. Also please let we know if I am following a wrong way of identifying elements and using it. From the web page I was able to find the right Xpath, but when it comes in TC its not even identifying the element.3.4KViews0likes3Comments- 3.4KViews0likes1Comment
Wait for Xpath
Hi, I am using test complete for web testing and preferred XPATH to find elements. But I couldnt find a proper wait statement for xpath other than hard coded wait statements. My scripts are failing due to this and sometimes the inbuilt methods like click(), exists etc are also getting failed. Please find a sample script below. The language used is Python def waitelement_click(): page = Sys.Browser("chrome").Page("xyz.com") viewcombtn = page.FindChildByXPath("//span[text()='View Comments']") select_lst = page.FindChildByXPath("//span[@class='selected']") selrange = page.FindChildByXPath("//span[text()='Year to Date']") firstissue = page.FindChildByXPath("//div[@class='mdc-layout-grid action-bar list-bar ng-star-inserted'][1]//span[@class='blue']") creator = page.FindChildByXPath("//div[@class='mdc-layout-grid action-bar list-bar ng-star-inserted'][1]//span[5]") addcmtbtn = page.FindChildByXPath("//span[@class='val add-comment ng-star-inserted']")# popup = pop_parent.WaitChild('''Panel("cdk_overlay_55")''',5000) viewcombbtn.Click() select_lst.Click() selrange.Click() Log.Message(creator.contentText) firstissue.Click() addcmtbtn.Click() The failures are mainly in between clicking different buttons.. Please give me a solution.Solved3.5KViews0likes8CommentsRe: Wait for Xpath
Thanks Alex, A question on this part:- "One more note as for your code. The code looks like a port from Selenium code that implements page object model. This code in TestCOmplete will work only in the case if all sought for objects (viewcombtn, select_lst, ...) exist at the moment of search. If the select_lst object appears only after the click on the viewcombtn, then your code will not work because the search for select_lst will fail anyway as the object will not exist until the button is clicked." As you pointed out viewcombtn is clicked first and all the other elements comes to the page after this click.If am using waitElement() in test complete, will the code executes in that way we expect- with out considering the fact that "in TestCOmplete will work only in the case if all sought for objects (viewcombtn, select_lst, ...) exist at the moment of search" Thanks in advance Vibin3.5KViews0likes5Comments