Package org.openqa.selenium
Interface ContextAware
-
public interface ContextAware
Some implementations of WebDriver, notably those that support native testing, need the ability to switch between the native and web-based contexts. This can be achieved by using this interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description WebDriver
context(java.lang.String name)
Switch the focus of future commands for this driver to the context with the given name.java.lang.String
getContext()
Return an opaque handle to this context that uniquely identifies it within this driver instance.java.util.Set<java.lang.String>
getContextHandles()
Return a set of context handles which can be used to iterate over all contexts of this WebDriver instance.
-
-
-
Method Detail
-
context
WebDriver context(java.lang.String name)
Switch the focus of future commands for this driver to the context with the given name.- Parameters:
name
- The name of the context as returned bygetContextHandles()
.- Returns:
- This driver focused on the given window.
- Throws:
NoSuchContextException
- If the context cannot be found.
-
getContextHandles
java.util.Set<java.lang.String> getContextHandles()
Return a set of context handles which can be used to iterate over all contexts of this WebDriver instance.- Returns:
- A set of context handles which can be used to iterate over available contexts.
-
getContext
java.lang.String getContext()
Return an opaque handle to this context that uniquely identifies it within this driver instance. This can be used to switch to this context at a later date.- Returns:
- The current context handle.
-
-