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

Coded Step : Finding Page Elements

3 Answers 198 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pravin
Top achievements
Rank 1
Pravin asked on 30 Mar 2017, 06:23 AM

Hi guys, 

Good day, have a question on Findings Page elements through coded steps. Hope you guys can assist me :)

I'm trying to locate an element in an IE web browser through coded step using Find.ByAttributes() without any luck.

These are the attributes i'm using to detect in my Find.ByAttributes() coded step : 

1) TagName

2) InnerText

3) role

These are the code snippet that i'm using : 

Element record = Find.ByAttributes("TagName=td","InnerText=~" + ((string)(System.Convert.ChangeType(Data["Name"], typeof(string)))), "role=gridcell");

 Assert.IsNotNull(record, "Record not found.");

For InnerText attribute, i'm would like to read a partial value from an excel sheet (NameExcel.PNG) and i'm using "~" as based in the documentation,"~" signifies partial

Name.PNG is the element i'm looking to read in the browser

But every time i run the script, my Assert fails (ElementLog.PNG) which is weird because as you can see in (Element.PNG), the same attributes can be detected by Telerik if i recorded and use "Edit Element" option.

 

Another question is, will the below code snippet be able to click on the element once it's detected? 

ActiveBrowser.Actions.Click(record);

The whole idea of this script is to detect the element that contains these attributes and click on it.

Many thanks in advance :) 

Best Regards,

Pravin

praja@dongenergy.dk

 

 

 

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 03 Apr 2017, 03:30 PM
Hello Pravin,

Thanks for your interest in Telerik Test Studio. 

Would it be possible to prepare a sample script against a public accessible page demonstrating the reported inconsistent behavior? I will be happy to investigate the issue along but I will need an example to test with. 

Thanks for your understanding! 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Pravin
Top achievements
Rank 1
answered on 05 Apr 2017, 05:01 AM

Hi Elena,

At the moment, I can't seem to find a public page that simulates the same scenario. Is there any other additional information that i could perhaps provide you to help investigate further this issue?

From the coding point of view, is the codes i used the correct steps?

Many thanks (:

Thanks,

Pravin

praja@dongenergy.dk

 

 

0
Elena
Telerik team
answered on 06 Apr 2017, 03:00 PM
Hello Pravin,

Thanks for getting back to me. 

Since there is no sample page you could share there is one more option. Our next best option is if you could capture a Fiddler trace of the problem page. We have about a 75% success rate using such a capture to simulate your web server and reproduce problems. 

Follow these steps:

1 Start Fiddler - note no browser should be open
2 Click Clear Cache
3 If your site uses HTTPS click Decrypt HTTPS traffic
4 Start Capture
5 Launch a browser
6 Navigate to the problem page containing the elements in question.
7 Stop Capture
8 Save Capture
9 Put the .SAZ file into a .zip file and attach that to this support ticket. 

Additionally I would like to kindly ask you to add a sample test script that executes the captured actions so that I could have the whole picture. 

Thank you for your cooperation! 

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