我想让我的Selenium Grid在Chrome驱动程序上运行.
起初我开始使用hub和node:java -jar selenium-server-standalone-2.45.0.jar -role hub java -jar selenium-server-standalone-2.45.0.jar -role node -hub http:// localhost: 4444 /网格/寄存器
比我启动我的测试:
public class ChromeDriverTest {
private WebDriver driver = null;
String BaseURL,NodeURL;
@Before
public void before() throws Exception{
BaseURL="http://www.google.com";
NodeURL="http://localhost:4444/wd/hub";
File file = new File("C:\\Users\\pushkaryova\\Desktop\\Nexus\\driver\\chromedriver.exe");
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
DesiredCapabilities capa =DesiredCapabilities.chrome();
capa.setBrowserName("chrome");
capa.setPlatform(Platform.ANY);
driver=new RemoteWebDriver(new URL(NodeURL),capa);
}
@Test
public void GoogleSearch() throws Exception {
driver.get("http://www.google.com");
WebElement searchBox = driver.findElement(By.xpath("//div[3]/div/input[1]"));
hightlight(searchBox);
driver.findElement(By.xpath("//div[3]/div/input[1]")).clear();
driver.findElement(By.xpath("//div[3]/div/input[1]")).sendKeys("Test");
driver.findElement(By.xpath("//button")).click();
}
public void hightlight(WebElement webElement) throws InterruptedException {
for (int i …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Espresso自动执行Android应用程序,即聊天机器人。我可以说我是Android应用程序自动化的全新手。现在,我正苦苦等待。如果我使用thread.sleep,它可以很好地工作。但是我想等待特定的文本出现在屏幕上-我该怎么做?
@Rule
public ActivityTestRule<LoginActivity> mActivityTestRule = new ActivityTestRule<>(LoginActivity.class);
@Test
public void loginActivityTest() {
ViewInteraction loginName = onView(allOf(withId(R.id.text_edit_field),
childAtPosition(childAtPosition(withId(R.id.email_field),0), 1)));
loginName.perform(scrollTo(), replaceText("test@test.test"), closeSoftKeyboard());
ViewInteraction password= onView(allOf(withId(R.id.text_edit_field),
childAtPosition(childAtPosition(withId(R.id.password_field),0), 1)));
password.perform(scrollTo(), replaceText("12345678"), closeSoftKeyboard());
ViewInteraction singInButton = onView(allOf(withId(R.id.sign_in), withText("Sign In"),childAtPosition(childAtPosition(withId(R.id.scrollView), 0),2)));
singInButton .perform(scrollTo(), click());
Run Code Online (Sandbox Code Playgroud)
//这里我需要等待文本“ Hi ...” //一些解释:按下按钮签名后,聊天机器人说“ hi”,会提供更多信息,我想等待最后一条消息出现屏幕上。