-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementing support for switching context as described here: http://…
…code.google.com/p/selenium/source/browse/spec-draft.md?repo=mobile#133 - this feature will be used by mobile WebDriver users to switch between different contexts like the native or the webview UI element tree - The feature is end to end tested with latest selendroid snapshot version (6a126ab3782deb7dd0cc99c6e3785c72d636959b)
- Loading branch information
1 parent
b086af5
commit 8b6b171
Showing
11 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
java/client/src/org/openqa/selenium/NoSuchContextException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
Copyright 2014 Software Freedom Conservancy | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package org.openqa.selenium; | ||
|
||
/** | ||
* Thrown by {@link org.openqa.selenium.WebDriver.TargetLocator#context(String) WebDriver.switchTo().context(String | ||
* name)}. | ||
*/ | ||
public class NoSuchContextException extends NotFoundException { | ||
|
||
public NoSuchContextException(String reason) { | ||
super(reason); | ||
} | ||
|
||
public NoSuchContextException(String reason, Throwable cause) { | ||
super(reason, cause); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
java/client/test/org/openqa/selenium/ContextSwitchingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright 2014 Software Freedom Conservancy | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package org.openqa.selenium; | ||
|
||
import static org.openqa.selenium.testing.Ignore.Driver.IPHONE; | ||
import static org.openqa.selenium.testing.Ignore.Driver.MARIONETTE; | ||
import static org.openqa.selenium.testing.Ignore.Driver.OPERA_MOBILE; | ||
|
||
import org.junit.Test; | ||
import org.openqa.selenium.remote.DesiredCapabilities; | ||
import org.openqa.selenium.remote.RemoteWebDriver; | ||
import org.openqa.selenium.testing.Ignore; | ||
import org.openqa.selenium.testing.JUnit4TestBase; | ||
|
||
public class ContextSwitchingTest extends JUnit4TestBase { | ||
|
||
@Test(expected = UnsupportedCommandException.class) | ||
public void testShouldNotBeAbleToSwitchContext() { | ||
driver.switchTo().context("WEBVIEW"); | ||
} | ||
|
||
@Test(expected = UnsupportedCommandException.class) | ||
public void testShouldNotBeAbleToGetContextHandle() { | ||
driver.getContext(); | ||
} | ||
|
||
@Test(expected = UnsupportedCommandException.class) | ||
public void testShouldNotBeAbleToGetContextHandles() { | ||
driver.getContextHandles(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters