java - Automated testing using selenium with firefox browser -
i downloaded code below , used tests , u=it ran yesterday since today code stopped working. tests failing not happening before. throws error saying org.openqa.selenium.elementnotvisibleexception: element not visible cannot interact element.
package org.openqa.selenium.example; //import org.openqa.selenium.browserlaunchers.locators.googlechromelocator; //import java.util.regex.pattern; import java.util.concurrent.timeunit; import org.junit.*; import static org.junit.assert.*; //import org.openqa.selenium.*; import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.webelement; //import org.openqa.selenium.chrome.*; import org.openqa.selenium.firefox.*; import org.openqa.selenium.firefox.firefoxdriver; //import org.openqa.selenium.support.ui.select; //import org.openqa.selenium.net.urlchecker; import static org.junit.assert.assertequals; import org.junit.test; public class kongaurltest { private webdriver driver; private string baseurl; //private boolean acceptnextalert = true; private stringbuffer verificationerrors = new stringbuffer(); @before public void setup() throws exception { driver = new firefoxdriver(); baseurl = "http://www.konga.com/"; driver.manage().timeouts().implicitlywait(30, timeunit.seconds); } @test public void testfirefoxwebdriver() throws exception { driver.get(baseurl); driver.findelement(by.cssselector("a.vertnavlink > span")).click(); try { assertequals("phones & tablets | konga nigeria", driver.gettitle()); system.out.println(driver.gettitle()); } catch (error e) { verificationerrors.append(e.tostring()); } } @after public void teardown() throws exception { system.out.println(driver.getcurrenturl()); driver.quit(); } }
there's blocking dialog being displayed. it's displayed each time selenium opens new browser , navigates site. close dialog first:
driver.get(baseurl); try { driver.findelement(by.cssselector(".fancybox-close")).click(); } catch { } driver.findelement(by.cssselector("a.vertnavlink > span")).click();
Comments
Post a Comment