2

A link on page 1 opens a new page "receipt page". It contains only text values. I need to assert or verify values on the receipt page to ensure that this is the correct receipt.

After executing the line

driver.find_element_by_link_text("Print Order!").click() #this what navigates the receipt page 

the following tags are returned and must be validated:

<div style="border-bottom:1px dashed black;">
<span>Receipt No: 197</span>
<span style="font-size:smaller;font-weight:lighter;margin-left:130px;">16/10/2012 -04:10 pm </span>
<br>
<span>Customer Name: 123</span>
<br>
<span>Cashier Name: engy</span>
<br>
<br>
<table width="100%" style="font-size:smaller; border-bottom:1px dotted black;text-align:center;">
<br>
<span>Total Cost: 5700</span>
4
  • I think I understand the problem you are trying to solve, but what is your question?
    – user246
    Commented Oct 16, 2012 at 15:45
  • now i succeeded to make a test case that do some actions and the last action is to generate a receipt page to be printed. my question is i need to verify text on that page to ensure that it's the correct receipt
    – engy
    Commented Oct 17, 2012 at 11:51
  • What is preventing you from doing this? You don't mention any blocking issues, or give a description of what sort of failure is occurring. Are you asking what should you verify on the receipt page, or how to do it?
    – Sam Woods
    Commented Oct 17, 2012 at 15:38
  • no, i'm asking what code to write to verify a text on a page with "about:blank" URL how to make selenium webdriver point to that new page.
    – engy
    Commented Oct 18, 2012 at 11:03

1 Answer 1

1

In C# the code would be:

driver.SwitchTo().Window(driver.WindowHandles.Last());

This will switch to the newly opened window and then you would treat it just like any other page. To switch back would be:

driver.SwitchTo().DefaultContent();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.