本文整理了Java中org.openqa.selenium.remote.RemoteWebDriver.setFileDetector
方法的一些代码示例,展示了RemoteWebDriver.setFileDetector
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RemoteWebDriver.setFileDetector
方法的具体详情如下:
包路径:org.openqa.selenium.remote.RemoteWebDriver
类名称:RemoteWebDriver
方法名:setFileDetector
[英]Set the file detector to be used when sending keyboard input. By default, this is set to a file detector that does nothing.
[中]
代码示例来源:origin: selenide/selenide
private WebDriver createRemoteDriver(Config config, Proxy proxy) {
try {
DesiredCapabilities capabilities = getDriverCapabilities(config, new Browser(config.browser(), false), proxy);
RemoteWebDriver webDriver = new RemoteWebDriver(new URL(config.remote()), capabilities);
webDriver.setFileDetector(new LocalFileDetector());
return webDriver;
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Invalid 'remote' parameter: " + config.remote(), e);
}
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui
@Override
public void setFileDetector(FileDetector detector)
{
this.wrappedDriver.setFileDetector(detector);
}
代码示例来源:origin: stackoverflow.com
RemoteWebDriver rdriver = new RemoteWebDriver(caps);
rdriver.setFileDetector(new LocalFileDetector());
WebElement element = rdriver.findElement(By
.xpath(".//input[@type='file']"));
element.sendKeys("D:/Profiles/user/workspace/copla-selenium/src/test/resources/datasets/default/test-image.jpg");
代码示例来源:origin: springernature/omelet
public WebDriver returnRemoteDriver() {
String remoteUrl;
if (host.contains("browserstack") || host.contains("sauce")
|| host.contains("testingbot")) {
remoteUrl = "http://" + USERNAME + ":" + AUTOMATE_KEY + "@"
+ host + ":" + port + "/wd/hub";
} else {
remoteUrl = "http://" + host + ":" + port + "/wd/hub";
}
try {
RemoteWebDriver driver = new RemoteWebDriver(
new URL(remoteUrl), dc);
// set local file detector for uploading file
driver.setFileDetector(new LocalFileDetector());
return driver;
} catch (MalformedURLException e) {
LOGGER.error(e);
return null;
}
}
}
代码示例来源:origin: kg.apc/jmeter-plugins-webdriver
@Override
protected RemoteWebDriver createBrowser() {
try {
RemoteWebDriver driver = new RemoteWebDriver(new URL(getSeleniumGridUrl()), createCapabilities());
driver.setFileDetector(createFileDetector());
LOGGER.debug("Created web driver with " + createFileDetector().getClass().getName());
return driver;
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: fhoeben/hsac-fitnesse-fixtures
@Override
public T createDriver() {
T remoteWebDriver = constr.apply(url, capabilities);
FileDetector fd = remoteWebDriver.getFileDetector();
if (fd == null || fd instanceof UselessFileDetector) {
remoteWebDriver.setFileDetector(new LocalFileDetector());
}
Environment.getInstance().setSymbol(REMOTE_URL_KEY, url.toString());
return remoteWebDriver;
}
}
代码示例来源:origin: net.serenity-bdd/serenity-core
public static void forDriver(WebDriver driver) {
if (resolvedDriverFrom(driver) instanceof RemoteWebDriver) {
try {
((RemoteWebDriver) resolvedDriverFrom(driver)).setFileDetector(new LocalFileDetector());
} catch(WebDriverException e) {
if (!e.getMessage().contains("only works on remote webdriver instances obtained via RemoteWebDriver")) {
throw e;
}
}
}
}
代码示例来源:origin: alfa-laboratory/akita
/**
* Задает capabilities для запуска Remote драйвера для Selenoid
*
* @param capabilities - capabilities для установленного браузера
* @param remoteUrl - url для запуска тестов, например http://remoteIP:4444/wd/hub
* @return WebDriver
*/
private WebDriver getRemoteDriver(MutableCapabilities capabilities, String remoteUrl) {
log.info("---------------run Selenoid Remote Driver---------------------");
capabilities.setCapability("enableVNC", true);
capabilities.setCapability("screenResolution", String.format("%sx%s", loadSystemPropertyOrDefault(WINDOW_WIDTH, DEFAULT_WIDTH),
loadSystemPropertyOrDefault(WINDOW_HEIGHT, DEFAULT_HEIGHT)));
try {
RemoteWebDriver remoteWebDriver = new RemoteWebDriver(
URI.create(remoteUrl).toURL(),
capabilities
);
remoteWebDriver.setFileDetector(new LocalFileDetector());
return remoteWebDriver;
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.mycore/selenium-utils
@Override
public WebDriver getDriver() {
WebDriver remoteDriver = null;
try {
String driverLocation = System.getProperty(DRIVER_URL_PROPERTY_NAME, DEFAULT_URL);
LOGGER.info(String.format(Locale.ENGLISH,"%s is : %s", DRIVER_URL_PROPERTY_NAME, driverLocation));
remoteDriver = new RemoteWebDriver(new URL(driverLocation), getCapabilities());
} catch (MalformedURLException e) {
LOGGER.error("error while resolving firefox driver location", e);
}
remoteDriver.manage().window().setSize(new Dimension(dimX, dimY));
remoteDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
((RemoteWebDriver) remoteDriver).setFileDetector(new LocalFileDetector());
return remoteDriver;
}
代码示例来源:origin: qaprosoft/carina
@Override
public void doAttachFile(String filePath) {
final String decryptedText = cryptoTool.decryptByPattern(filePath, CRYPTO_PATTERN);
String textLog = (!decryptedText.equals(filePath) ? "********" : filePath);
DriverListener.setMessages(Messager.FILE_ATTACHED.getMessage(textLog, getName()),
Messager.FILE_NOT_ATTACHED.getMessage(textLog, getNameWithLocator()));
((JavascriptExecutor) getDriver()).executeScript("arguments[0].style.display = 'block';", element);
((RemoteWebDriver) getDriver()).setFileDetector(new LocalFileDetector());
element.sendKeys(decryptedText);
}
代码示例来源:origin: vmi/selenese-runner-java
log.info("Session ID: " + driver.getSessionId());
setInitialWindowSize(driver, driverOptions);
driver.setFileDetector(new LocalFileDetector());
return driver;
代码示例来源:origin: stackoverflow.com
new URL("http://<username>:<api-key>@ondemand.saucelabs.com:80/wd/hub"),
capabillities);
driver.setFileDetector(new LocalFileDetector());
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
代码示例来源:origin: org.finra.jtaf/jtaf-extwebdriver
remoteWebDriver.setFileDetector(new LocalFileDetector());
wd = remoteWebDriver;
}else {
代码示例来源:origin: FINRAOS/JTAF-ExtWebDriver
remoteWebDriver.setFileDetector(new LocalFileDetector());
wd = remoteWebDriver;
}else {
代码示例来源:origin: iainrose/page-objects
@BeforeClass(alwaysRun = true)
public void setupWebDriver() throws MalformedURLException {
if (REMOTE_DRIVER) {
setupRemoteDriver();
driver.setFileDetector(new LocalFileDetector());
} else {
setupLocalDriver();
}
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
代码示例来源:origin: bedatadriven/activityinfo
@Override
public WebDriver start(String name, BrowserProfile profile) {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("name", name);
capabilities.setCapability("build", System.getenv("BUILD_TAG"));
if(!Strings.isNullOrEmpty(System.getenv("SELENIUM_BROWSER"))) {
capabilities.setCapability(CapabilityType.BROWSER_NAME, System.getenv("SELENIUM_BROWSER"));
capabilities.setCapability(CapabilityType.VERSION, System.getenv("SELENIUM_VERSION"));
capabilities.setCapability(CapabilityType.PLATFORM, System.getenv("SELENIUM_PLATFORM"));
} else if(profile != null) {
capabilities.setCapability(CapabilityType.BROWSER_NAME, profile.getType().sauceId());
capabilities.setCapability(CapabilityType.VERSION, profile.getVersion().toString());
capabilities.setCapability(CapabilityType.PLATFORM, osName(profile));
} else {
capabilities.setCapability(CapabilityType.BROWSER_NAME, BrowserType.CHROME);
}
if(SAUCE_FAST.isPresent()) {
capabilities.setCapability("record-video", false);
capabilities.setCapability("record-screenshots", false);
}
RemoteWebDriver remoteWebDriver = new RemoteWebDriver(getWebDriverServer(), capabilities);
System.out.println(format("SauceOnDemandSessionID=%s job-name=%s", remoteWebDriver.getSessionId(), name));
remoteWebDriver.setFileDetector(new LocalFileDetector());
return remoteWebDriver;
}
代码示例来源:origin: com.infotel.seleniumRobot/core
@Override
public WebDriver createWebDriver() {
// create capabilities, specific to OS
MutableCapabilities capabilities = createSpecificGridCapabilities(webDriverConfig);
capabilities.merge(driverOptions);
// app must be uploaded before driver creation because driver will need it in mobile app testing
// upload file on all available grids as we don't know which one will be chosen before driver has been created
for (SeleniumGridConnector gridConnector: gridConnectors) {
gridConnector.uploadMobileApp(capabilities);
}
// connection to grid is made here
driver = getDriver(capabilities);
setImplicitWaitTimeout(webDriverConfig.getImplicitWaitTimeout());
if (webDriverConfig.getPageLoadTimeout() >= 0 && SeleniumTestsContextManager.isWebTest()) {
setPageLoadTimeout(webDriverConfig.getPageLoadTimeout());
}
this.setWebDriver(driver);
runWebDriver();
((RemoteWebDriver)driver).setFileDetector(new LocalFileDetector());
return driver;
}
代码示例来源:origin: viltgroup/minium
public WebDriver create(WebDriverProperties webDriverProperties) throws IOException {
DesiredCapabilities desiredCapabilities = new DesiredCapabilities(webDriverProperties.getDesiredCapabilities());
desiredCapabilities.merge(browserSpecificCapabilities(webDriverProperties));
WebDriver webDriver = null;
if (webDriverProperties.getUrl() != null) {
RemoteWebDriver remoteDriver = new RemoteWebDriver(webDriverProperties.getUrl(), desiredCapabilities);
remoteDriver.setFileDetector(new LocalFileDetector());
webDriver = remoteDriver;
} else {
String browserName = desiredCapabilities == null ? null : desiredCapabilities.getBrowserName();
if (Strings.isNullOrEmpty(browserName)) browserName = BrowserType.CHROME;
webDriver = WebDriverType.typeFor(browserName).create(this, desiredCapabilities);
}
WindowProperties window = webDriverProperties.getWindow();
if (window != null) {
DimensionProperties size = window.getSize();
PointProperties position = window.getPosition();
if (size != null) webDriver.manage().window().setSize(new Dimension(size.getWidth(), size.getHeight()));
if (position != null) webDriver.manage().window().setPosition(new Point(position.getX(), position.getY()));
if (window.isMaximized()) {
webDriver.manage().window().maximize();
}
}
webDriver = webDriver instanceof TakesScreenshot ? webDriver : new Augmenter().augment(webDriver);
for (WebDriverTransformer transformer : driverServices.getWebDriverTranformers()) webDriver = transformer.transform(webDriver);
return webDriverProperties.isStateful() ? new StatefulWebDriver(webDriver) : webDriver;
}
内容来源于网络,如有侵权,请联系作者删除!