I will appreciated your help to slove my popup windows problem
I try to do an Automate test with Selenium and Java . When I execute the test with FireFox 30, there is an popup windows that appears in the middle of my execution window . This popup windows covers the first window.
How can eliminate or disable this popupwindow ?
I tired a lot of thing , also this but still no working
String winHandleBefore = driver.getWindowHandle();
// Perform the click operation that opens new window
// Switch to new window opened
for (String winHandle : driver.getWindowHandles()) {
driver.switchTo().window(winHandle);
}
// Perform the actions on new window
driver.close(); //this will close new opened window
//switch back to main window using this code
driver.switchTo().window(winHandleBefore);
This is my code
**This is my code:**
public void setUp() throws Exception{
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability("browser", "Firefox");
capability.setCapability("browser_version", "30.0");
capability.setCapability("os", "Windows");
capability.setCapability("os_version", "7");
capability.setCapability("resolution", "1280x1024");
capability.setCapability("build", "JUnit - Sample");
capability.setCapability("browserstack.debug", "true");
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("plugin.state.flash", 0);
capability.setCapability(FirefoxDriver.PROFILE, profile);
driver = new RemoteWebDriver(new URL("http://a@hub.browserstack.com/wd/hub"),capability);
baseUrl = "http://www.d.com/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testCodigo3() throws Exception {
driver.get(baseUrl + "/");
driver.manage().window().maximize();
//Menu
WebElement menu=driver.findElement(By.xpath("//div[@id='olMain']/nav/ul/li[4]/a/span"));
//SubMenu
WebElement submenu =driver.findElement(By.xpath("//div[@id='olMain']/nav/ul/li[4]/div/div/ol/li[3]/ul/li/a"));
Actions action = new Actions (driver);
action.moveToElement(menu).perform();
Thread.sleep(2000);
action.click(submenu);
driver.findElement(By.linkText("TV LED")).click();