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

7 posts, 0 answers
  1. Abdul Khader
    Abdul Khader avatar
    22 posts
    Member since:
    Feb 2016

    Posted 01 Mar Link to this post

    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.

  2. Abdul Khader
    Abdul Khader avatar
    22 posts
    Member since:
    Feb 2016

    Posted 01 Mar in reply to Abdul Khader Link to this post

     

    Sorry guys, I missed the attachment in the above post

     

    Here it is

  3. Abdul Khader
    Abdul Khader avatar
    22 posts
    Member since:
    Feb 2016

    Posted 02 Mar Link to this post

    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

  4. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 03 Mar Link to this post

    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!
  5. Abdul Khader
    Abdul Khader avatar
    22 posts
    Member since:
    Feb 2016

    Posted 07 Mar in reply to Konstantin Petkov Link to this post

    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

     

     

     

  6. Abdul Khader
    Abdul Khader avatar
    22 posts
    Member since:
    Feb 2016

    Posted 09 Mar in reply to Abdul Khader Link to this post

    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 ?

     

  7. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 09 Mar Link to this post

    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!
Back to Top