本文整理汇总了Java中org.testcontainers.containers.BrowserWebDriverContainer类的典型用法代码示例。如果您正苦于以下问题:Java BrowserWebDriverContainer类的具体用法?Java BrowserWebDriverContainer怎么用?Java BrowserWebDriverContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BrowserWebDriverContainer类属于org.testcontainers.containers包,在下文中一共展示了BrowserWebDriverContainer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: beforeEach
import org.testcontainers.containers.BrowserWebDriverContainer; //导入依赖的package包/类
@Override
// public void beforeEach(ExtensionContext context) throws Exception {
public void beforeEach(TestExtensionContext context) throws Exception {
BrowserWebDriverContainer webDriverContainer
= new BrowserWebDriverContainer()
.withDesiredCapabilities(DesiredCapabilities.chrome()); // only one per container
webDriverContainer.start();
Slf4jLogConsumer logConsumer = new Slf4jLogConsumer(LoggerFactory.getLogger(this.getClass()));
webDriverContainer.followOutput(logConsumer);
storeTestcontainer().accept(context, webDriverContainer);
storeWebDriver().accept(context, webDriverContainer::getWebDriver);
}
示例2: doSimpleWebdriverTest
import org.testcontainers.containers.BrowserWebDriverContainer; //导入依赖的package包/类
protected void doSimpleWebdriverTest(BrowserWebDriverContainer rule) {
RemoteWebDriver driver = setupDriverFromRule(rule);
System.out.println("Selenium remote URL is: " + rule.getSeleniumAddress());
System.out.println("VNC URL is: " + rule.getVncAddress());
//Runtime.getRuntime().exec("open " + rule.getVncUrl(driver)); // For debugging, on a Mac
driver.get("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("testcontainers");
driver.findElement(By.name("q")).submit();
assertEquals("the word 'testcontainers' appears in the search box", "testcontainers", driver.findElement(By.name("q")).getAttribute("value"));
}
示例3: doSimpleExplore
import org.testcontainers.containers.BrowserWebDriverContainer; //导入依赖的package包/类
protected static void doSimpleExplore(BrowserWebDriverContainer rule) {
RemoteWebDriver driver = setupDriverFromRule(rule);
driver.get("http://en.wikipedia.org/wiki/Randomness");
// Oh! The irony!
assertTrue("Randomness' description has the word 'pattern'", driver.findElementByPartialLinkText("pattern").isDisplayed());
}
示例4: testAdditionalStartupString
import org.testcontainers.containers.BrowserWebDriverContainer; //导入依赖的package包/类
@Test
public void testAdditionalStartupString() {
try (BrowserWebDriverContainer chrome = new BrowserWebDriverContainer("selenium/standalone-chrome-debug:" + tag)
.withDesiredCapabilities(DesiredCapabilities.chrome())) {
chrome.start();
}
}
示例5: testCreationOfManyContainers
import org.testcontainers.containers.BrowserWebDriverContainer; //导入依赖的package包/类
@Test @Ignore
public void testCreationOfManyContainers() {
for (int i = 0; i < 50; i++) {
BrowserWebDriverContainer container = new BrowserWebDriverContainer()
.withDesiredCapabilities(DesiredCapabilities.chrome())
.withRecordingMode(BrowserWebDriverContainer.VncRecordingMode.RECORD_FAILING, new File("target"));
container.start();
RemoteWebDriver driver = container.getWebDriver();
driver.get("http://www.google.com");
container.stop();
}
}
示例6: testcontainer
import org.testcontainers.containers.BrowserWebDriverContainer; //导入依赖的package包/类
public static Function<ExtensionContext, BrowserWebDriverContainer> testcontainer() {
return (context) -> store().apply(context).get(TESTCONTAINER, BrowserWebDriverContainer.class);
}
示例7: storeTestcontainer
import org.testcontainers.containers.BrowserWebDriverContainer; //导入依赖的package包/类
public static BiConsumer<ExtensionContext, BrowserWebDriverContainer> storeTestcontainer() {
return (context, webDriver) -> store().apply(context).put(TESTCONTAINER, webDriver);
}
示例8: BrowserErrors
import org.testcontainers.containers.BrowserWebDriverContainer; //导入依赖的package包/类
public BrowserErrors(String name, BrowserWebDriverContainer webDriver) {
this.name = name;
this.webDriver = webDriver;
}
示例9: setupDriverFromRule
import org.testcontainers.containers.BrowserWebDriverContainer; //导入依赖的package包/类
@NotNull
private static RemoteWebDriver setupDriverFromRule(BrowserWebDriverContainer rule) {
RemoteWebDriver driver = rule.getWebDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
return driver;
}