List of usage examples for org.openqa.selenium NoSuchFrameException NoSuchFrameException
public NoSuchFrameException(String reason)
From source file:com.atanas.kanchev.testframework.selenium.handlers.Wait.java
License:Apache License
/** * {@inheritDoc}/*w w w.j ava 2s. co m*/ */ @Override public boolean isFrameAvailable(By locator, long wait) { try { getWait(wait).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(locator)); return true; } catch (NoSuchFrameException e) { logger.error("No frame found located by " + locator.toString()); throw new NoSuchFrameException(e.getMessage()); } }
From source file:com.opera.core.systems.scope.services.ums.EcmaScriptDebugger.java
License:Apache License
public void changeRuntime(int index) { buildRuntimeTree();//from w w w . j av a 2 s. co m RuntimeNode node = root.getNodes().get(index + 1); if (node == null) { throw new NoSuchFrameException("Invalid frame index " + index); } RuntimeInfo info = runtimesList.get(node.getRuntimeID()); currentFramePath = info.getHtmlFramePath(); setRuntime(info); }
From source file:com.opera.core.systems.scope.services.ums.EcmaScriptDebugger.java
License:Apache License
public void changeRuntime(String frameName) { buildRuntimeTree();/* www . j a v a2 s .c o m*/ RuntimeNode curr = root; curr = findNodeByName(frameName, curr); if (curr == null) { throw new NoSuchFrameException("Invalid frame name " + frameName); } RuntimeInfo info = runtimesList.get(curr.getRuntimeID()); // We should only find frames underneath the current one. if (!info.getHtmlFramePath().startsWith(currentFramePath)) { throw new NoSuchFrameException("No such frame " + frameName + " in " + currentFramePath); } currentFramePath = info.getHtmlFramePath(); setRuntime(info); }
From source file:com.opera.core.systems.scope.services.ums.EcmascriptService.java
License:Apache License
public void changeRuntime(int index) { buildRuntimeTree();/*from w ww .ja va 2 s. c o m*/ RuntimeNode node = root.getNodes().get(index + 1); if (node == null) { throw new NoSuchFrameException("Invalid frame index " + index); } Runtime info = runtimesList.get(node.getRuntimeID()); currentFramePath = info.getHtmlFramePath(); setRuntime(info); }
From source file:com.opera.core.systems.scope.services.ums.EcmascriptService.java
License:Apache License
public void changeRuntime(String frameName) { buildRuntimeTree();/*w w w .j a v a 2 s . co m*/ String[] values = frameName.split("\\."); RuntimeNode curr = root; for (String value : values) { curr = findNodeByName(value, curr); if (curr == null) { break; } } if (curr == null) { throw new NoSuchFrameException("Invalid frame name " + frameName); } Runtime info = runtimesList.get(curr.getRuntimeID()); // We should only find frames underneath the current one. if (!info.getHtmlFramePath().startsWith(currentFramePath)) { throw new NoSuchFrameException("No such frame " + frameName + " in " + currentFramePath); } currentFramePath = info.getHtmlFramePath(); setRuntime(info); }
From source file:com.opera.core.systems.scope.stp.services.ScopeEcmascriptService.java
License:Apache License
public void changeRuntime(String frameName) { checkNotNull(frameName);/*ww w. j av a 2s .co m*/ buildRuntimeTree(); String[] values = frameName.split("\\."); RuntimeNode curr = root; for (String value : values) { curr = findNodeByName(value, curr); if (curr == null) { break; } } if (curr == null) { throw new NoSuchFrameException("Invalid frame name " + frameName); } Runtime info = runtimesList.get(curr.getRuntimeID()); // We should only find frames underneath the current one. if (!info.getHtmlFramePath().startsWith(currentFramePath)) { throw new NoSuchFrameException("No such frame " + frameName + " in " + currentFramePath); } currentFramePath = info.getHtmlFramePath(); setRuntime(info); }
From source file:com.redhat.darcy.webdriver.internal.CachingTargetedWebDriverTest.java
License:Open Source License
@Test public void shouldReturnFalseForIsPresentIfCannotSwitchToTargetFrame() { WebDriver mockedDriver = mock(WebDriver.class); TargetLocator mockedTargetLocator = mock(TargetLocator.class); when(mockedDriver.switchTo()).thenReturn(mockedTargetLocator); when(mockedTargetLocator.frame("not-present")).thenThrow(new NoSuchFrameException("No such window")); TargetedWebDriverFactory targetedDriverFactory = new CachingTargetedWebWebDriverFactory(mockedDriver, WebDriverTargets.window("test")); TargetedWebDriver targetedDriver = targetedDriverFactory .getTargetedWebDriver(WebDriverTargets.frame(WebDriverTargets.window("test"), "not-present")); assertFalse(targetedDriver.isPresent()); }
From source file:org.uiautomation.ios.server.command.web.SetFrameHandler.java
License:Apache License
private RemoteWebElement getIframe(Integer index) throws Exception { List<RemoteWebElement> iframes = getSession().getRemoteWebDriver() .findElementsByCssSelector("iframe,frame"); try {//from w w w .ja v a2 s. c om return iframes.get(index); } catch (IndexOutOfBoundsException i) { throw new NoSuchFrameException("detected " + iframes.size() + " frames. Cannot get index = " + index); } }
From source file:org.uiautomation.ios.webInspector.DOM.RemoteWebElement.java
License:Apache License
public RemoteWebElement getContentDocument() throws Exception { JSONObject cmd = new JSONObject(); cmd.put("method", "Runtime.callFunctionOn"); JSONArray args = new JSONArray(); cmd.put("params", new JSONObject().put("objectId", getRemoteObject().getId()) .put("functionDeclaration", "(function(arg) { var document = this.contentDocument; return document;})") .put("arguments", args).put("returnByValue", false)); JSONObject response = inspector.sendCommand(cmd); RemoteObject ro = inspector.cast(response); if (ro == null) { throw new NoSuchFrameException("Cannot find the document associated with the frame."); } else {/*from ww w .ja v a2 s. co m*/ return ro.getWebElement(); } }
From source file:org.uiautomation.ios.webInspector.DOM.RemoteWebElement.java
License:Apache License
public RemoteWebElement getContentWindow() throws Exception { JSONObject cmd = new JSONObject(); cmd.put("method", "Runtime.callFunctionOn"); JSONArray args = new JSONArray(); cmd.put("params", new JSONObject().put("objectId", getRemoteObject().getId()) .put("functionDeclaration", "(function(arg) { var window = this.contentWindow; return window;})") .put("arguments", args).put("returnByValue", false)); JSONObject response = inspector.sendCommand(cmd); RemoteObject ro = inspector.cast(response); if (ro == null) { throw new NoSuchFrameException("Cannot find the window associated with the frame."); } else {/*from w w w . j av a2 s . c om*/ return ro.getWebElement(); } }