I have looked everywhere and was unable to find a solution to this issue. Any help would greatly be appreciated.
Exception message follows:
ArtOfTest.Common.Design.Exceptions.ExecutionException: Wait for condition has timed out ---> System.TimeoutException: Wait for condition has timed out
at ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo)
at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout, WaitResultType errorResultType)
at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout)
at ArtOfTest.WebAii.Core.Browser.WaitUntilReady()
at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request)
at ArtOfTest.WebAii.Core.Actions.InvokeEvent(Element targetElement, ScriptEventType eventType)
at ArtOfTest.WebAii.Design.IntrinsicTranslators.Descriptors.InvokeEventActionDescriptor.Execute(Browser browser)
at ArtOfTest.WebAii.Design.Extensibility.HtmlActionDescriptor.Execute(IAutomationHost autoHost)
at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteStep(Int32 order)
--- End of inner exception stack trace ---
19 Answers, 1 is accepted
This is difficult to diagnose out of context. Please use the Export Result to File feature from the Step Failure Details to provide more information.
Have you tried changing that step's SimulateRealClick Test Step Property to True?
Anthony
the Telerik team
Please note that the invoke JS OnClick event does not have a 'Simulate real click' property in Test Studio. Is there a way to do it via a coded step?
Thank you for the additional files.
Sorry for the confusion; I actually meant disabling the JavaScript OnClick step and using a basic Click step in its place. Then set that Click step to SimulateRealClick to True.
I tested this against this W3 Schools demo page, and both a standard Click step and Invoke OnClick step worked to copy the text. I don't see an OnClick attached to the "Properties" link in your DOM, however:
<
H2
id
=
wcmTab_t2
-tab
class
=
tab
><
A
href
=
"#"
>Properties</
A
></
H2
>
So perhaps a standard Click step, or a Left Click Mouse Action from the Elements Menu, is the way to go. Greetings,
Anthony
the Telerik team
I will try the left click and see if that works.
So far the only one that does what it is suppose to is the OnClick event. But then it times out after.
Can you grant us direct access to your site so we can test this directly? If not, can you provide a public site that demonstrates the same behavior?
When you say the clicks don't work, do you mean that step fails? Or does the click occur yet the expected page state does not change?
Another idea is to Invoke a Blind Mouse Click, and base that click on a consistent reference element.
Anthony
the Telerik team
Unfortunately, the websites I am testing are all internal to our organization and there are no public sites with the same behavior.
Now that you mention an AJAX postback, try Waiting for the AJAX Postback to Complete with a coded step. This ensures synchronization with the postback event.
Anthony
the Telerik team
It seems that the OnClick is happening, but it seems as if it is waiting for a response before moving to the next step.
I have the Same Problem I'm New to Telerik and C#, Could you send sample code
I've converted my recored click step into coded step
When execute i'm Getting error
Failure Information:
~~~~~~~~~~~~~~~
Exception thrown executing coded step: '[WebTest2_CodedStep] : @"Click 'TestNewUserLink0''.
InnerException:
System.TimeoutException: Wait for condition has timed out
at ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo)
at ArtOfTest.Common.WaitSync.For[T,V](Func`3 func, T target, V custom, Boolean invertCondition, Int32 timeout)
at ArtOfTest.WebAii.Synchronization.Wait.ForCondition(Func`3 condition, Boolean invertCondition, Object custom, Int32 timeout)
at ArtOfTest.WebAii.Synchronization.Wait.ForExists(Int32 timeout, Boolean refreshElement)
at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get(HtmlFindExpression expr, Boolean waitOnElement, Int32 timeout)
at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get(HtmlFindExpression expr)
at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get[TControl](HtmlFindExpression expr)
at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get[TControl](String[] clauses)
Let's continue with the W3Schools demo page example. Using the JavaScript Events feature from the Elements Menu, you can record the following step against the Copy Text button:
- Invoke 'OnClick' event on 'CopyTextButtonTag'
It appears you recorded an actual click step against your "Test New User" Link. Record an OnClick step instead from the Elements Menu.
Jonathan converted the OnClick step to code. In our example it becomes this:
// Invoke 'OnClick' event on 'CopyTextButtonTag'
Pages.TryitEditorV151.FrameView.CopyTextButtonTag.InvokeEvent(ArtOfTest.WebAii.Core.ScriptEventType.OnClick);
And to bypass the "wait for a response before continuing," he set the closesBrowser boolean to True:
Pages.TryitEditorV151.FrameView.CopyTextButtonTag.InvokeEvent(ArtOfTest.WebAii.Core.ScriptEventType.OnClick,
true
);
Greetings,
Anthony
the Telerik team
Test Studio Trainings
Thank You for sending me a Reply, I tried this w3schools copy text with code also without code just by recording steps. Its working fine.
my Scenarios is, I will create the Users and it is listed under the User Tab
If i click particular user in my Example( TestNewUser) , It should Navigate nextpage with that users Details.
What happend is If i record the click for(TestNewUser), Its added to the Elements(DOM) with the Properties
Findlogic = [href 'Exact' /MembershipAdministration/UserDetails/userID= "somenumbers"] AND [InnerText 'Exact' Test_User] AND [TagName 'Exact' a]
Expression = TagName=a,href 'Exact' /MembershipAdministration/UserDetails/userid = "somenumbers " ,InnerText=Test_User
So If i run the test , its linke anotherclick, so that userid="somenumbers" doesn't match with previous, gives error "href...." no elementfound
This is the issue
This is a separate issue. It sounds like you need a Data Driven Find Expression. In other words, if your new user creation is Data Driven, then you can use the data value of the current iteration to find the link that is subsequently created.
Since you currently cannot data drive through the Find Element dialog, you can instead use a couple lines of code to accomplish this. The last sample on this page shows an example:
HtmlAnchor a = Find.ByExpression<HtmlAnchor>(
"tagname=a"
,
"innertext="
+ Data[
"Col1"
].ToString());
a.Click();
If you're not data driving, you can perform an Extraction and then Access the Extracted Variable in code and use it in the coded find logic.
All the best,
Anthony
the Telerik team
Test Studio Trainings
I have Username in Xl file. I did the Data Driven for username, With that I've Craeted a new User, Its Listed in the Page.
When I click that user it will navigate to the User Details Page, To do that I've used
HtmlAnchor a = Find.ByExpression<HtmlAnchor>(
"tagname=a"
,
"innertext="
+ Data[
"Username"
].ToString());
a.Click();
Now, In the NAvigated Page, I've Link "DeleteUser", If Click that, User should be deleted, I tried the Same abovecode for "deleteuser"
System.NullReferenceException: Object reference not set to an instance of an object.
Can't i use the same htmlanchor for deleteuser?
Also Another question, If there is no data driven How should the click works with the find expression
HtmlAnchor a = Find.ByExpression<HtmlAnchor>("tagname = a" ,"InnerText = Test_Admin","TextContent=Test_admin");
a.Click();
Click 'TestAdminLink3''. ---> System.NullReferenceException: Object reference not set to an instance of an object.
1. Yes, you can reuse that code, however you'll probably need to edit it to indicate a partial match. Currently it's written to find an exact match and if the InnerText does not match the data value exactly, the link won't be found.
Use a tilde (~) to indicate a partial match:
HtmlAnchor a = Find.ByExpression<HtmlAnchor>(
"tagname=a"
,
"innertext=~"
+ Data[
"Username"
].ToString());
a.Click();
2. You'll probably need to search based on partial match when not data driving as well. Also it's rare that you'd need to use InnerText and TextContent. Pick the one that best suits how your page's HTML is formatted. See here for more information on validation content element types.
Kind regards,
Anthony
the Telerik team
Test Studio Trainings
Thank you so much for you help,
If i delete the user, I have to go back and have to verify the list items, it appears like, i tried to use with quick task, but it didn't worked out well.
2 -> i need to verify the Table(just html table tag with <tr> <td> ) in some other page. for example
The following is a list
Name | Description | Additional Info | Action |
---|---|---|---|
Portfolio 1 | p1 | ||
TestPortfolio | AutomateTestPortFolio | ||
If i want to delete the second one, How to verify the "Name" to that corresponding click ( Its actually long list, i may want any row delete, each row has delete button)
I appreciate your suggestion.
1. Try targeting the parent <ol> or <ul> element to base your verification (find it directly in the DOM), as demonstrated in this article. This assumes you're dealing with an actual Ordered or Unordered List. If not, there's likely a parent <div> you can target instead.
2. See the following code sample:
//Identify the table. This may need to be modified based on your page layout.
HtmlTable table = Find.ByExpression<HtmlTable>(
"TagIndex=table:0"
);
Assert.IsNotNull(table);
//Access the row with matching text. The InnerText can be data driven.
HtmlTableRow row = table.Find.ByExpression<HtmlTableRow>(
"innertext=~TestPortfolio"
,
"tagname=tr"
);
//Access the fourth cell in that row.
HtmlTableCell cell = row.Cells[3];
//Access the "Delete" link in that cell.
HtmlAnchor a = cell.Find.ByExpression<HtmlAnchor>(
"innertext=~Delete"
,
"tagname=a"
);
a.Click();
For future reference, please file a separate support ticket or forum post for new issues. This ensures better tracking and responses for both parties.
Kind regards,
Anthony
the Telerik team
Test Studio Trainings