tags:

views:

394

answers:

2

I am using Selenium-python script for web test automation. When ever I use selenium inbuilt commands, I will get Attribute error during run time.

Ex: selenium.WindowFocus("preview_email") throws "AttributeError: class selenium has no attribute 'WindowFocus'"

I am new to test automation. Help me to sort out this problem.

A: 

I have never used the Python client personally, but a quick glance at the selenium.py file reveals that there is a window_focus command which gives the currently "selected" window focus ("selected" in Selenium terms is the window that Selenium is currently executing commands against and not necessarially the window that has user focus).

Executing the select_window command with a window ID will set tell Selenium which window you want to execute commands against.

I have had some trouble w/ popups in general and the way the Selenium IDE and RC clients attempt to locate new windows and/or there parents. Good luck.

Benjamin Lee
+1  A: 

The command that you are looking for is selenium.window_focus()

AutomatedTester