Hii Ranga,
I am not able to handle popwindow/alert in selenium webdriver.
I tried both code below.
Alert javascriptAlert = driver.switchTo().alert();
javascriptAlert.accept();
It is not able to click OK button of Modal dailog window.The execution
is stopping here.Not able to close or click OK.After forcefully
closing it is getting close.
THe 2nd one is
windowids = driver.getWindowHandles();
iter= windowids.iterator();
String mainWindowId=iter.next();
String popupWindowId=iter.next();
driver.switchTo().window(popupwindowid);
Here Iam able to close window but not able to get my requirement.and
here i am getting exception like nosuch element.
My requirement is to gettext of that modal dailog box and click OK
button .
If you wont mind please help me.
On Jun 7, 12:25 pm, ranga rao <
crangara...@gmail.com> wrote:
> 1. "webdeiver.switchTo().window()"
> this method to a window with know name.
>
> 2. "webdriver.getwindowHandles()"
> to obtain o list of know window. you may pass the handle to
> "switchto().window()"
>
> 3. if you are using python and webdriver
> def close_all_popups(driver):
> driver.window_handles
> for h in driver.window_handles[1:]:
> driver.switch_to_window(h)
> driver.close()
> driver.switch_to_window(driver.window_handles[0])
> it will close except parent window.
>
> On 7 June 2012 12:43, ramshankar behera <
ramshankar.beh...@gmail.com> wrote:
>
>
>
> > Hi,,,,
>
> > I tried
> > Alert alert = driver.switchTo().alert();
> > alert.accept()
>
> > But i am getting Exception ( if there is any solution then please send
> > me that code in
ramshankar.beh...@gmail.com
> *Ranga*
> Mob: 91-9986686264