TA的每日心情 | 开心 2017-5-11 14:09 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]测试小兵
|
运行程序后,chrome确实有被打开,但是又立马关闭了,反反复复大概有3次,不知道哪里出错了,跪求大神指导!
程序代码如下:
package uu;
import java.io.File;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.xml.DOMConfigurator;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.CapabilityType;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
public class test3 {
public AppiumDriver Driver;
@Test
public void f() {
}
@Before
public void setUp() throws Exception {
//配置log4j的配置文件为log4j.xml
//DOMConfigurator.configure("log4j.xml");
//set up appium
//获取当前路径
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName","m3 note");
capabilities.setCapability("platformVersion", "5.1");
System.out.println("1111111111111111111111");
capabilities.setCapability("browserName", "Chrome");
capabilities.setCapability("appPackage", "com.android.chrome");
capabilities.setCapability("appActivity", "org.chromium.chrome.browser.ChromeTabbedActivity");
//capabilities.setCapability("MobileCapabilityType.AUTOMATION_NAME", "AutomationName.ANDROID_UIAUTOMATOR2");
Driver = new AndroidDriver(new URL("http://localhost:4723/wd/hub"), capabilities);
System.out.println("手机自动化开始测试");
Driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
Driver.get("http://www.qq.com");
Thread.sleep(5000);
}
@After
public void afterMethod() {
//Driver.quit();
}
}
|
|