javascript - Selenium WebDriver using Java throwing error in IE -
public static string switchtopopupwindow() throws interruptedexception { string popupwindowhandle = null; try { // save current window handle future reference defaultwindow = driver.getwindowhandle(); // window handles 1 one (string windowhandle : driver.getwindowhandles()) { // save new window handle if (!windowhandle.equals(defaultwindow)) { popupwindowhandle = windowhandle; } } // switches pop-up window driver.switchto().window(popupwindowhandle); // maximize browser window driver.manage().window().maximize(); // log result application_logs.debug("switched pop-up window"); return "pass : switched pop-up window"; } catch (throwable switchtopopupwindowexception) { // log error application_logs.debug("error while switching pop window : " + switchtopopupwindowexception.getmessage()); return "fail : error while switching pop window : " + switchtopopupwindowexception.getmessage(); } string result=switchtopopupwindow(); // handle certificate error if (config.getproperty("test_browser").tolowercase().contains("internet explorer")) { if (driver.gettitle().contains(navigationblockedtitle)) { driver.navigate().to("javascript:document.getelementbyid('overridelink').click()"); functionlibrary.waitforpagetoload(); } } public static boolean iselementpresent(by locator, string elemname) { application_logs.debug("checking whether " + elemname + " present on page or not ..."); try { // check whether web element displayed or not driver.findelement(locator); application_logs.debug(elemname + " present on page"); return true; } catch (nosuchelementexception elementpresenterror) { application_logs.debug(elemname + " not present on page"); return false; } } // verify page container element booleanreturnresult = functionlibrary.iselementpresent(by.id("pagecontainer1"), "'page container' web element"); if (!booleanreturnresult) return failtest + " : print summary page not present.";
problem: code snippet works mozilla firefox gives error on usage iedriver(used versions 2.47.2 , 2.53.1) after using code handling security pages. because of error unable confirm whether elements present in popup window , returns page element not present. type of error mentioned below.
type of error:
error came while waiting page load : javascript error (warning: server did not provide stacktrace information) command duration or timeout: 10 milliseconds build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46' system info: host: 'ankit', ip: '172.16.238.156', os.name: 'windows 7', os.arch: 'amd64', os.version: '6.1', java.version:'1.8.0_11' driver info: org.openqa.selenium.ie.internetexplorerdriver capabilities [{browserattachtimeout=0, ie.enablefullpagescreenshot=true, enablepersistenthover=true,ie.forcecreateprocessapi=false, ie.forceshellwindowsapi=false, pageloadstrategy=normal, ignorezoomsetting=false, ie.fileuploaddialogtimeout=3000, version=11, platform=windows, nativeevents=true, ie.ensurecleansession=false,elementscrollbehavior=0, ie.browsercommandlineswitches=, requirewindowfocus=false, browsername=internet explorer,initialbrowserurl=http://localhost:37308/, javascriptenabled=true, ignoreprotectedmodesettings=false,enableelementcachecleanup=true, unexpectedalertbehaviour=dismiss}] session id: 59fadeed-485c-47f9-ac3c-73dab0177a2a [26/10/2016 15:05:28] checking whether 'page container' web element present on page or not ... [26/10/2016 15:05:32] 'page container' web element not present on page
Comments
Post a Comment