Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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>
share|improve this question
    
I think I understand the problem you are trying to solve, but what is your question? –  user246 Oct 16 '12 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 Oct 17 '12 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 Oct 17 '12 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 Oct 18 '12 at 11:03

1 Answer 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();

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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