cancel
Showing results for 
Search instead for 
Did you mean: 

Waiting for XPath or CSS elements(TimeOut)

Occasional Contributor

Waiting for XPath or CSS elements(TimeOut)

Hi All,

 

In Javascript for xpath Locators how can we provide implicit waitTime .

Below is the script designed ,can anyone help for below code.

 

browser = Sys.Browser(*);

page = browser.Page('myURL');

SignOut_Button = page.Buttons.FindChildByXPath('/*[@id='signout']/div[1]')

if (SignOut_Button.Exists) {

    SignOut_Button.Click();

}

 

Thanks

Vijaysimha

4 REPLIES 4
Community Hero

Re: Waiting for XPath or CSS elements(TimeOut)

Hi,

 

a) No way. You must search within a loop and exit when the sought for object is found or timeout elapses;

b) Search by XPath is highly not recommended for TestComplete. Consider .FindXXX() methods instead. .FindChildEx() method has a parameter to specify the thing that you are looking for;

c) Your code is not correct. See the Result Value section of the FindChildByXPath() help topic - if the sough for object is not found then null is returned. (And if found, then either TC object that contains .Exists property or native DOM object that does not contain .Exists may be returned depending on what exact object was found.)

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Community Manager

Re: Waiting for XPath or CSS elements(TimeOut)

Hi @vijaysimha,

 

Could you please explain your task in detail?

Perhaps, we can suggest alternative solutions.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Occasional Contributor

Re: Waiting for XPath or CSS elements(TimeOut)

Hi @TanyaGorbunova 

 

In Javascript i have written function  for  dynamic xpath which accept text as parameterized.

For this script i have to wait until visibility of xpath found in page.

Hence provide solution for waitTime with example.

 

Note: Delay keyword is not encourged in my Organisation.

 

Community Hero

Re: Waiting for XPath or CSS elements(TimeOut)

Hi,

 

> Hence provide solution for waitTime

https://community.smartbear.com/t5/TestComplete-Desktop-Testing/Waiting-for-XPath-or-CSS-elements-Ti..., option a).

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
New Here?
Join us and watch the welcome video:
Top Kudoed Authors