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

How to click a link which is inside a cell of HTML Table based on Index value ?

6 Answers 202 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Abdul Khader
Top achievements
Rank 1
Abdul Khader asked on 01 Mar 2016, 04:20 PM

Hi Team,

 

Please guide me how can I Click on "Edit" link just by giving the index number as shown in the attached Image

This Edit link is also a part of HTML table and so far I figured out the code as :

 

            HtmlTable table = Find.ByExpression<HtmlTable>("TagIndex=table:0");
            Assert.IsNotNull(table);
            
            HtmlTableRow row = table.Find.ByExpression<HtmlTableRow>("innertext=~Edit","tagname=tr","tagindex=a:0");
            
            HtmlTableCell cell = row.Cells[3];
            HtmlAnchor a = cell.Find.ByExpression<HtmlAnchor>("innertext=~Edit","tagname=a");
            a.Click();

 

But this code is NOT working. Please guide me how to accomplish this task ?

 

Note : the values in the table cells are always changing i.e., they are dynamic. So we cannot rely on existing data.

6 Answers, 1 is accepted

Sort by
0
Abdul Khader
Top achievements
Rank 1
answered on 01 Mar 2016, 04:22 PM

 

Sorry guys, I missed the attachment in the above post

 

Here it is

0
Abdul Khader
Top achievements
Rank 1
answered on 02 Mar 2016, 03:35 PM

Hi Team,

 

Can anyone please look into this Issue and provide a solution as my testing is completely blocked because of this.

 

Please let me know if anymore information is required regarding this Issue

 

Thanks

Abdul

0
Konstantin Petkov
Telerik team
answered on 03 Mar 2016, 08:18 AM
Hi Abdul,

I'd approach the task this way:
  1. Locate the table as you do - I guess that works fine
  2. Locate the table row by index within this table
  3. Find the edit link within this row and click it.
If that still doesn't work please share details as to how exactly the test fails as well as the exact HTML you deal with. You can observe the Page DOM on step failure to figure out what has to be correct in your find logic. Please do not hesitate to also export the failure details and send those as attachment here or via a private support ticket if you prefer.

Regards,
Konstantin Petkov
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Abdul Khader
Top achievements
Rank 1
answered on 07 Mar 2016, 10:35 AM

Hi Konstantin,

 

Thanks for the approach and it worked for me.

I have one other query for you but NOT related to HTML.

 

Query :

 

Let say I have two tests - Test A and Test B

 

Test A - It contains only one coded step and inside it has "this.ExecuteTest(test_path);" . I am sending Test Path as an argument.

Test B - It contains some recorded steps

 

I am calling Test B from Test A.

After test execution, if Test B fails, I want to return a value to Test A like "Fail"

 

How can I achieve this ?

 

Let me know If you need more information.

 

Thanks

Abdul

 

 

 

0
Abdul Khader
Top achievements
Rank 1
answered on 09 Mar 2016, 10:36 AM

Hi Konstantin,

 

Can you have a look into this Issue and let me know the best solution ?

After Test B execution is completed, I just want to send a value from Test B as "FAIL" to Test A 

 

How can I achieve this ?

 

0
Boyan Boev
Telerik team
answered on 09 Mar 2016, 12:56 PM
Hi Abdul,

Since this is a completely new issue please create a new ticket about it.

The best practice is to split separate issues in different tickets which help us better investigate and handle them in timely manner.

Thank you for your understandings!

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Abdul Khader
Top achievements
Rank 1
Answers by
Abdul Khader
Top achievements
Rank 1
Konstantin Petkov
Telerik team
Boyan Boev
Telerik team
Share this question
or