Saturday, July 2, 2011

How to identify frame name in a web page

This is especially an issue for folks trying to test their scripts out on Gmail for example.
Well, luckily for our audience we have crossed that bridge before and here is how we did it:
NOTE: In our test I am testing multiple email providers (gmail is just one of them)

if ($provider_name eq "Gmail"){
  $sel->type_ok("Email", $email, 'Enter Email');
  $sel->type_ok("Passwd", $pword, 'Enter Password');
  $sel->click_ok("PersistentCookie", 'Click stay signed in');
  $sel->click_ok("signIn", 'Click Login button');
  $sel->wait_for_page_to_load_ok("30000");
  $sel->wait_for_element_present("canvas_frame");
<<<<<<<<<<< this is the key.
  $sel->select_frame_ok("canvas_frame");
<<<<<<< then select the "canvas_frame"
  # more test code here
}


Your test will always fail if you do not select the frame by using a locator such as name.

No comments:

Post a Comment

Creative Commons License
VGP-Miami Web and Mobile Automation Blog by Alfred Vega is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.