This is a migrated thread and some comments may be shown as answers.

Button not recognized

1 Answer 99 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sven
Top achievements
Rank 1
Sven asked on 13 Aug 2013, 07:29 AM
Hello,

I just downloaded the Test Studio to see if it meets our requirements.

However when trying to record a first test I run into the following problem:

If I create a click event on a Button that is coded like this:

<input class="loginInputField" name="j_newUser" type="button" onclick="document.loginForm.j_username.value=checkUserName();document.loginForm.submit();" value="Login"/>

it is working perfectly fine.

However the following Button is not recognized as the ID always changes. The program is stuck at "locating elements":

<input type="button" style="width: 500px;" value="Klärfälle" id="rnd672292135" name="Clarification Cases" class="startPageButton" onchange="showSaveButtons(this); markAsChanged(this);;;" onclick="javascript:loadMacroForm('clarificationCases.xml', 'mainDiv');"/>

I googled a bit and found that i can adress this button using:

Dim e As Element = Find.ByExpression("name=Clarification Cases")
Assert.IsNotNull(e)
Actions.Click(e)

working fine so far. My Problem now is that i have another button of that type, which doesnt have a unique name. When i Try to execute the same bit of code using "Find.ByExpression("value=xxxx")" it won't find the button and abort.

Can anyone tell me how to adress this button?

<
input type="buttonvalue="Versichertenorientierten Klärfall anlegenid="rnd2046738466name="nullclass="buttononchange="showSaveButtons(this); markAsChanged(this);;;"
 
onclick="javascript:syncMacro('commands/LoadForm','pages/clarificationcase/showClarificationCase.xml,var.clarificationKind=insurant','mainDiv');"/>

Thank you.








1 Answer, 1 is accepted

Sort by
0
Velin Koychev
Telerik team
answered on 16 Aug 2013, 07:03 AM
Hello Sven,

I am sorry to hear you are running into this problem.

The approach you are using should work. My only suspicion is about the ä letter that might be the reason for your issue. However, I recorded a short video to demonstrate that everything works as expected on my side. 

What ever is the reason, you can try to use the following expression:
Dim e2 As Element = Find.ByExpression("value=~Versichertenorientierten")

This will search for element having value that contains Versichertenorientierten

You can read more about finding page elements with code in our documentation

I hope this helps. 

Regards,
Velin Koychev
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Sven
Top achievements
Rank 1
Answers by
Velin Koychev
Telerik team
Share this question
or