Consider the following piece of code:
//click function here take care of sending click command to selenium RC Server
$object->click('link=www.somelink.com');
//Type command sends USERNAME to the Selenium RC Server to be typed in input box with ID: username
$object->type('id=username', 'USERNAME');
Now the above mentioned code works good for Firefox, but it throws Permission denied error with IE.
Reason for that is as we have clicked on the link, and the page has to refresh, therefore when we try to type into some field on GUI that has not loaded yet, selenium throws Permission denied error.
Simple solution to above is to use clickAndWait command instead of just click, which will give some time to GUI to get refreshed or load before executing the next command.
so our new code will look like this:
//It clicks on the link and then waits for page to load dynamically for default time out value of selenium
$object->click_and_wait('link=www.somelink.com');
$object->type('id=username', 'USERNAME');
Now it works fine for both IE and Firefox.
However for applications that involve AJAX or changing display properties to block or none on click, this solution does not work.
For these, we need to either use explicit sleep($time_in_seconds) command [ Not suggested though ], or we can wait for some element on the refreshed GUI, which will make the page to wait before actually typing in the field.
Modified code will look something similar to as mentioned below:
$object->click('link=www.somelink.com');
//This will make the page to wait to load dynamically till HTML Field id=username becomes accessible and will solve our permission denied problem.
$object->wait_for_element('id=username');
$object->type('id=username');
Hope it helps. Let me know if you are unable to fix any Permission denied error with above mentioned solution.
Thanks,
QuickSilver1183
QuickSilver1183@gmail.com