#1 楼 @chenhengjie123 图是测试发图发不出的 bug。
这个帖子也顶下,另外可以用 chromedriver 来自动化模拟。
package com.testerhome;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.assertTrue;
/**
* Created by lihuazhang on 15/4/4.
*/
public class ChromeMobileEmulatorTest {
private WebDriver driver;
@Before
public void createDriver() {
Map<String, String> mobileEmulation = new HashMap<String, String>();
mobileEmulation.put("deviceName", "Google Nexus 5");
Map<String, Object> chromeOptions = new HashMap<String, Object>();
chromeOptions.put("mobileEmulation", mobileEmulation);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
driver = new ChromeDriver(capabilities);
}
@After
public void quitDriver() {
driver.quit();
}
@Test
public void testBaiduSearch() throws InterruptedException {
driver.get("http://www.baidu.com");
Thread.sleep(5000); // Let the user actually see something!
WebElement searchBox = driver.findElement(By.name("word"));
searchBox.sendKeys("ChromeDriver");
searchBox.submit();
Thread.sleep(5000); // Let the user actually see something!
assertTrue(driver.getPageSource().contains("ChromeDriver"));
driver.quit();
}
}
我是来顶帖子的!有些细节好像不对。
#11 楼 @zoo4778362 不招了吧?
@wenchao
➜ Desktop python test.py
result_20150512111752.html
.
Time Elapsed: 0:00:06.288321
➜ Desktop
测试通过。和你的脚本一抹一眼,除了把退格改成了 backspace
Remote install failed: pkg: /data/local/tmp/43adfe9fcfc6677441d5aa5b07ab07df.apk
为啥还要安装啊?
#7 楼 @pighero001 多谢鼓励,目前还是没有到社会型。testerhome 目前对于内容的聚合能力比较弱小。
好东西啊!
都后天了
测试下,挖掘机