Java Code Examples for org.openqa.selenium.remote.RemoteWebElement#setFileDetector()

The following examples show how to use org.openqa.selenium.remote.RemoteWebElement#setFileDetector() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonToMobileElementConverter.java    From java-client with Apache License 2.0 6 votes vote down vote up
@Override
protected RemoteWebElement newRemoteWebElement() {
    Class<? extends RemoteWebElement> target;
    target = getElementClass(platform, automation);

    try {
        Constructor<? extends RemoteWebElement> constructor = target.getDeclaredConstructor();
        constructor.setAccessible(true);
        RemoteWebElement result = constructor.newInstance();

        result.setParent(driver);
        result.setFileDetector(driver.getFileDetector());

        return result;
    } catch (Exception e) {
        throw new WebDriverException(e);
    }
}
 
Example 2
Source File: PtlWebDriver.java    From hifive-pitalium with Apache License 2.0 5 votes vote down vote up
private RemoteWebElement setOwner(RemoteWebElement element) {
	if (driver != null) {
		element.setParent(driver);
		element.setFileDetector(driver.getFileDetector());
	}
	return element;
}
 
Example 3
Source File: AppPage.java    From teammates with GNU General Public License v2.0 5 votes vote down vote up
protected void fillFileBox(RemoteWebElement fileBoxElement, String fileName) {
    if (fileName.isEmpty()) {
        fileBoxElement.clear();
    } else {
        fileBoxElement.setFileDetector(new UselessFileDetector());
        String filePath = new File(fileName).getAbsolutePath();
        fileBoxElement.sendKeys(filePath);
    }
}
 
Example 4
Source File: AppPage.java    From teammates with GNU General Public License v2.0 5 votes vote down vote up
protected void fillFileBox(RemoteWebElement fileBoxElement, String fileName) {
    if (fileName.isEmpty()) {
        fileBoxElement.clear();
    } else {
        fileBoxElement.setFileDetector(new UselessFileDetector());
        String newFilePath = new File(fileName).getAbsolutePath();
        fileBoxElement.sendKeys(newFilePath);
    }
}