Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» FlexMonkium Download Not available under Gorillalogic site
Thu Dec 08, 2016 5:40 pm by bhanu.praveen

» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Modal dialogs in webdriver

View previous topic View next topic Go down

Modal dialogs in webdriver

Post by geeta.chaudhari on Fri Dec 09, 2011 12:19 pm

Hi all,

Has anybody successfully automated any application using modal dialogs using Webdriver?

Am badly in need of this solution.

-Geeta

geeta.chaudhari

Posts : 1
Join date : 2011-12-09

Back to top Go down

Re: Modal dialogs in webdriver

Post by ccnnll on Tue Dec 20, 2011 1:47 am

I have to a limited extent - I've been able to get the title of the modal and click the cancel or continue button (that's all I've needed to do) but it took me a while to get the xpath right to hook into the elements. Can you describe what you are trying to do?

ccnnll

Posts : 6
Join date : 2011-12-03

Back to top Go down

Re: Modal dialogs in webdriver

Post by veluruanil on Tue Oct 30, 2012 12:24 pm

Hi all,

I have a scenario where when we login with temporary password, a modal dialog box appears asking to reset the temporary password. When i try to automate the scenario my script is unable to identify the web elements in the dialog box which has 3 text boxes, two button Update Password and Cancel.

i have tried various ways like:

1) driver.switchTo().defaultContent(); -- to switch to the modal dialog box

2)Set availableWindows = driver.getWindowHandles();
System.out.println(availableWindows.size());

This prints as 1 saying we have only one dialog box.

Please help me on how to handle modal dialog boxes

veluruanil

Posts : 2
Join date : 2012-10-29

Back to top Go down

Re: Modal dialogs in webdriver

Post by ashish_techie on Wed Oct 31, 2012 12:47 am

There are various modal dialogs..

If its a lightbox then you will get xpaths and you can work
If its a windows authentication panel then you can use auto-it
Modal dialogs are not popups . they are part of same window


Regards
Ashish

For selenium tutorials:
www.qtpselenium.com/selenium-tutorials

ashish_techie
Amateur
Amateur

Posts : 73
Join date : 2011-08-09

Back to top Go down

Re: Modal dialogs in webdriver

Post by Love Sharma on Wed Oct 23, 2013 10:06 pm

Hi,
I am facing same problem with modal dialogs. When we open it, webdriver just losses it's control and it hangs without any error.

control does not even move to execute next statement of code and just nothing happens further.

Love Sharma
Regular Participant
Regular Participant

Posts : 27
Join date : 2012-06-01

Back to top Go down

Re: Modal dialogs in webdriver

Post by mail2prassad on Thu Oct 24, 2013 7:48 pm

We can work with Modal dialogs with Webdriver.

Try this code

Webdriver Code
============

Code:
import java.util.Iterator;





import org.openqa.selenium.By;


import org.openqa.selenium.WebDriver;


import org.openqa.selenium.WebElement;


import org.openqa.selenium.ie.InternetExplorerDriver;


import org.openqa.selenium.remote.DesiredCapabilities;





public class Example {





public static void main(String[] args)throws Exception {





DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();


capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);





WebDriver driver = new InternetExplorerDriver(capabilities);


driver.get("http://localhost:8080/demo/1.html");





WebElement button = driver.findElement(By.xpath("//input[@type = 'button']"));


button.click();





Thread.sleep(1000);





Iterator<String> itr = driver.getWindowHandles().iterator();


String main = itr.next();


String popup = itr.next();





System.out.println(main);


System.out.println(popup);





driver.switchTo().window(popup);





System.out.println(driver.findElement(By.xpath("//input[@id = 'mytext']")).getAttribute("value"));





}


}






1.html
=====

Code:
<html>


<head>


<script language="javascript">


function showPopup(){





window.showModalDialog('2.html','','dialogWidth:500px;dialogHeight:100px; resizable: no; status:no; return true;')





}


</script>


</head>


<body>


<input type="button" value="click" onClick="showPopup();"/>


</body>


</html>


2.html
======

Code:
<html>


<head>





</head>


<body>


<input type="text" id="mytext" name="mytext" value="Hello" />


</body>





</html>

Deploy 1.html and 2.html in demo webapplication and try running the webdriver code.

We can see the values in console output
==============================
cba55042-31df-4f21-90ca-5a09c125b9c1
eed6279d-8e39-477b-b189-37505a177f53
Hello

Thanks,
Prassad.

mail2prassad
Amateur
Amateur

Posts : 41
Join date : 2013-06-05

Back to top Go down

Re: Modal dialogs in webdriver

Post by Love Sharma on Thu Oct 24, 2013 9:13 pm

Thanks very much Prasad.
Can you also try to open 3,htm by clicking on button appearing in 2.htm?
It should open 3.htm at the top of 2.htm

Basically I tried your code but problem with webdriver is that when you click onĀ 
button.click();

just above thread.sleep(10000), webdriver looses control over modal dialog window. I am not able to click on button appearing in 2.htm file to open 3.htm

Please suggest on this.

Love Sharma
Regular Participant
Regular Participant

Posts : 27
Join date : 2012-06-01

Back to top Go down

Re: Modal dialogs in webdriver

Post by Sponsored content Today at 11:54 am


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum