org.openqa.selenium.chrome
Class ChromeDriver
java.lang.Object
org.openqa.selenium.chrome.ChromeDriver
- All Implemented Interfaces:
- FindsByClassName, FindsByCssSelector, FindsById, FindsByLinkText, FindsByName, FindsByTagName, FindsByXPath, JavascriptExecutor, SearchContext, TakesScreenshot, WebDriver
public class ChromeDriver
- extends java.lang.Object
- implements WebDriver, SearchContext, JavascriptExecutor, TakesScreenshot, FindsById, FindsByClassName, FindsByLinkText, FindsByName, FindsByTagName, FindsByXPath, FindsByCssSelector
Constructor Summary |
ChromeDriver()
Starts up a new instance of Chrome, with the required extension loaded,
and has it connect to a new ChromeCommandExecutor on its port |
ChromeDriver(ChromeProfile profile,
ChromeExtension extension)
Starts up a new instance of Chrome using the specified profile and
extension. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ChromeDriver
public ChromeDriver(ChromeProfile profile,
ChromeExtension extension)
- Starts up a new instance of Chrome using the specified profile and
extension.
- Parameters:
profile
- The profile to use.extension
- The extension to use.
ChromeDriver
public ChromeDriver()
- Starts up a new instance of Chrome, with the required extension loaded,
and has it connect to a new ChromeCommandExecutor on its port
- See Also:
ChromeDriver(ChromeProfile, ChromeExtension)
startClient
protected void startClient()
- By default will try to load Chrome from system property
webdriver.chrome.bin and the extension from
webdriver.chrome.extensiondir. If the former fails, will try to guess the
path to Chrome. If the latter fails, will try to unzip from the JAR we
hope we're in. If these fail, throws exceptions.
stopClient
protected void stopClient()
- Kills the started Chrome process and ChromeCommandExecutor if they exist
getServerUrl
protected java.lang.String getServerUrl()
close
public void close()
- Specified by:
close
in interface WebDriver
findElement
public WebElement findElement(By by)
- Specified by:
findElement
in interface SearchContext
- Specified by:
findElement
in interface WebDriver
findElements
public java.util.List<WebElement> findElements(By by)
- Specified by:
findElements
in interface SearchContext
- Specified by:
findElements
in interface WebDriver
get
public void get(java.lang.String url)
- Specified by:
get
in interface WebDriver
getCurrentUrl
public java.lang.String getCurrentUrl()
- Specified by:
getCurrentUrl
in interface WebDriver
getPageSource
public java.lang.String getPageSource()
- Specified by:
getPageSource
in interface WebDriver
getTitle
public java.lang.String getTitle()
- Specified by:
getTitle
in interface WebDriver
getWindowHandle
public java.lang.String getWindowHandle()
- Specified by:
getWindowHandle
in interface WebDriver
getWindowHandles
public java.util.Set<java.lang.String> getWindowHandles()
- Specified by:
getWindowHandles
in interface WebDriver
manage
public WebDriver.Options manage()
- Specified by:
manage
in interface WebDriver
navigate
public WebDriver.Navigation navigate()
- Specified by:
navigate
in interface WebDriver
quit
public void quit()
- Specified by:
quit
in interface WebDriver
switchTo
public WebDriver.TargetLocator switchTo()
- Specified by:
switchTo
in interface WebDriver
executeScript
public java.lang.Object executeScript(java.lang.String script,
java.lang.Object... args)
- Specified by:
executeScript
in interface JavascriptExecutor
isJavascriptEnabled
public boolean isJavascriptEnabled()
- Specified by:
isJavascriptEnabled
in interface JavascriptExecutor
findElementById
public WebElement findElementById(java.lang.String using)
- Specified by:
findElementById
in interface FindsById
findElementsById
public java.util.List<WebElement> findElementsById(java.lang.String using)
- Specified by:
findElementsById
in interface FindsById
findElementByClassName
public WebElement findElementByClassName(java.lang.String using)
- Specified by:
findElementByClassName
in interface FindsByClassName
findElementsByClassName
public java.util.List<WebElement> findElementsByClassName(java.lang.String using)
- Specified by:
findElementsByClassName
in interface FindsByClassName
findElementByLinkText
public WebElement findElementByLinkText(java.lang.String using)
- Specified by:
findElementByLinkText
in interface FindsByLinkText
findElementsByLinkText
public java.util.List<WebElement> findElementsByLinkText(java.lang.String using)
- Specified by:
findElementsByLinkText
in interface FindsByLinkText
findElementByName
public WebElement findElementByName(java.lang.String using)
- Specified by:
findElementByName
in interface FindsByName
findElementsByName
public java.util.List<WebElement> findElementsByName(java.lang.String using)
- Specified by:
findElementsByName
in interface FindsByName
findElementByTagName
public WebElement findElementByTagName(java.lang.String using)
- Specified by:
findElementByTagName
in interface FindsByTagName
findElementsByTagName
public java.util.List<WebElement> findElementsByTagName(java.lang.String using)
- Specified by:
findElementsByTagName
in interface FindsByTagName
findElementByXPath
public WebElement findElementByXPath(java.lang.String using)
- Specified by:
findElementByXPath
in interface FindsByXPath
findElementsByXPath
public java.util.List<WebElement> findElementsByXPath(java.lang.String using)
- Specified by:
findElementsByXPath
in interface FindsByXPath
findElementByPartialLinkText
public WebElement findElementByPartialLinkText(java.lang.String using)
- Specified by:
findElementByPartialLinkText
in interface FindsByLinkText
findElementsByPartialLinkText
public java.util.List<WebElement> findElementsByPartialLinkText(java.lang.String using)
- Specified by:
findElementsByPartialLinkText
in interface FindsByLinkText
findElementByCssSelector
public WebElement findElementByCssSelector(java.lang.String using)
- Specified by:
findElementByCssSelector
in interface FindsByCssSelector
findElementsByCssSelector
public java.util.List<WebElement> findElementsByCssSelector(java.lang.String using)
- Specified by:
findElementsByCssSelector
in interface FindsByCssSelector
getScreenshotAs
public <X> X getScreenshotAs(OutputType<X> target)
- Specified by:
getScreenshotAs
in interface TakesScreenshot
Copyright © 2010. All Rights Reserved.