本文整理汇总了Java中org.openqa.selenium.opera.OperaDriver类的典型用法代码示例。如果您正苦于以下问题:Java OperaDriver类的具体用法?Java OperaDriver怎么用?Java OperaDriver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OperaDriver类属于org.openqa.selenium.opera包,在下文中一共展示了OperaDriver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectLocalBrowser
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
public static WebDriver selectLocalBrowser() {
switch (browser) {
case Chrome:
return new ChromeDriver();
case Firefox:
return new FirefoxDriver();
case IE:
return new InternetExplorerDriver();
case Opera:
return new OperaDriver();
case Safari:
return new SafariDriver();
default:
throw new WebDriverException("No browser specified");
}
}
示例2: SeleniumExtension
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
public SeleniumExtension() {
handlerMap.put(ChromeDriver.class, ChromeDriverHandler.class);
handlerMap.put(FirefoxDriver.class, FirefoxDriverHandler.class);
handlerMap.put(EdgeDriver.class, EdgeDriverHandler.class);
handlerMap.put(OperaDriver.class, OperaDriverHandler.class);
handlerMap.put(SafariDriver.class, SafariDriverHandler.class);
handlerMap.put(RemoteWebDriver.class, RemoteDriverHandler.class);
handlerMap.put(AppiumDriver.class, AppiumDriverHandler.class);
handlerMap.put(List.class, ListDriverHandler.class);
handlerMap.put(PhantomJSDriver.class, OtherDriverHandler.class);
templateHandlerMap.put("chrome", ChromeDriver.class);
templateHandlerMap.put("firefox", FirefoxDriver.class);
templateHandlerMap.put("edge", EdgeDriver.class);
templateHandlerMap.put("opera", OperaDriver.class);
templateHandlerMap.put("safari", SafariDriver.class);
templateHandlerMap.put("appium", AppiumDriver.class);
templateHandlerMap.put("phantomjs", PhantomJSDriver.class);
templateHandlerMap.put("chrome-in-docker", RemoteWebDriver.class);
templateHandlerMap.put("firefox-in-docker", RemoteWebDriver.class);
templateHandlerMap.put("opera-in-docker", RemoteWebDriver.class);
}
示例3: resolve
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Override
public void resolve() {
try {
Optional<Object> testInstance = context.getTestInstance();
Optional<Capabilities> capabilities = annotationsReader
.getCapabilities(parameter, testInstance);
OperaOptions operaOptions = (OperaOptions) getOptions(parameter,
testInstance);
if (capabilities.isPresent()) {
operaOptions.merge(capabilities.get());
}
object = new OperaDriver(operaOptions);
} catch (Exception e) {
handleException(e);
}
}
示例4: createInstance
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
public WebDriver createInstance(Type type) {
switch (type) {
case CHROME:
return new ChromeDriver();
case CHROME_HEADLESS:
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless", "--disable-gpu");
ChromeDriver chromeDriver = new ChromeDriver(options);
return chromeDriver;
case OPERA:
return new OperaDriver(getOperaCapabilities());
case FIREFOX:
default:
return new FirefoxDriver();
}
}
示例5: setupTest
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Before
public void setupTest() {
File operaBinary = IS_OS_WINDOWS
? new File("C:\\Program Files\\Opera\\launcher.exe")
: new File("/usr/bin/opera");
assumeTrue(operaBinary.exists());
OperaOptions options = new OperaOptions();
options.setBinary(operaBinary);
driver = new OperaDriver(options);
}
示例6: testWithFirefoxAndOpera
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Test
public void testWithFirefoxAndOpera(FirefoxDriver firefox,
OperaDriver opera) {
firefox.get("http://www.seleniumhq.org/");
opera.get("http://junit.org/junit5/");
assertTrue(firefox.getTitle().startsWith("Selenium"));
assertTrue(opera.getTitle().equals("JUnit 5"));
}
示例7: operaTest
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Test
public void operaTest(OperaDriver driver) {
assertThat(driver, nullValue());
}
示例8: operaExtensionTest
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Test
void operaExtensionTest(
@Binary("/usr/bin/opera") @Extensions("atomizer.crx") OperaDriver driver) {
driver.get("https://bonigarcia.github.io/selenium-jupiter/");
assertThat(driver.getTitle(),
containsString("A JUnit 5 extension for Selenium WebDriver"));
}
示例9: operaTest
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Test
public void operaTest(
@Binary("/usr/bin/opera") @Arguments("private") OperaDriver driver) {
driver.get("https://bonigarcia.github.io/selenium-jupiter/");
assertThat(driver.getTitle(),
containsString("A JUnit 5 extension for Selenium WebDriver"));
}
示例10: forcedTestProvider
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
static Stream<Arguments> forcedTestProvider() {
return Stream.of(
Arguments.of(AppiumDriverHandler.class,
ForcedAppiumJupiterTest.class, AppiumDriver.class,
"appiumNoCapabilitiesTest"),
Arguments.of(AppiumDriverHandler.class,
ForcedAppiumJupiterTest.class, AppiumDriver.class,
"appiumWithCapabilitiesTest"),
Arguments.of(ChromeDriverHandler.class,
ForcedBadChromeJupiterTest.class, ChromeDriver.class,
"chromeTest"),
Arguments.of(FirefoxDriverHandler.class,
ForcedBadFirefoxJupiterTest.class, FirefoxDriver.class,
"firefoxTest"),
Arguments.of(RemoteDriverHandler.class,
ForcedBadRemoteJupiterTest.class, RemoteWebDriver.class,
"remoteTest"),
Arguments.of(EdgeDriverHandler.class,
ForcedEdgeJupiterTest.class, EdgeDriver.class,
"edgeTest"),
Arguments.of(OperaDriverHandler.class,
ForcedOperaJupiterTest.class, OperaDriver.class,
"operaTest"),
Arguments.of(SafariDriverHandler.class,
ForcedSafariJupiterTest.class, SafariDriver.class,
"safariTest"));
}
示例11: testOperaOptions
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Test
void testOperaOptions() throws Exception {
Parameter parameter = OperaWithOptionsJupiterTest.class
.getMethod("operaTest", OperaDriver.class).getParameters()[0];
OperaOptions operaOptions = (OperaOptions) annotationsReader
.getOptions(parameter, empty());
assertThat(operaOptions.asMap().get("operaOptions").toString(),
containsString("binary"));
}
示例12: start
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public OperaDriver start(Capabilities other) {
Capabilities capabilities = this.mergeCapabilities(other);
if (capabilities == null) {
return new OperaDriver();
}
return new OperaDriver(capabilities);
}
示例13: setupOperaDriver
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
protected void setupOperaDriver() {
DesiredCapabilities capabilities = DesiredCapabilities.operaBlink();
OperaOptions options = new OperaOptions();
options.setBinary(new File("/usr/bin/opera"));
capabilities.setCapability(OperaOptions.CAPABILITY, options);
setDriver(new OperaDriver(capabilities));
getDriver().manage().window().setSize(
new Dimension(1366, 768));
}
示例14: createDriver
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Override
public WebDriver createDriver(Capabilities capabilities) {
String driverVersion = (String) capabilities.getCapability(CAPABILITY_DRIVER_VERSION);
OperaDriverManager.getInstance().version(driverVersion).setup();
return new OperaDriver((OperaOptions) capabilities);
}
示例15: operaTest
import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Test
public void operaTest(OperaDriver driver) {
driver.get("https://bonigarcia.github.io/selenium-jupiter/");
assertThat(driver.getTitle(),
containsString("A JUnit 5 extension for Selenium WebDriver"));
}