Config.getConfBykey("wait.sleepInMillis");
这是个什么东西啊?我的编译器不认识 Config.getConfBykey 这个东东
官网上没看到,在哪里下载啊?是更新了 APPIUM 的库吗?
#2 楼 @benlooking 楼主 这个问题解决了吗?
#3 楼 @blue_momo2009 一起探讨探讨吧,大神们。
#1 楼 @lihuazhang 就是是远端的摁钮。web 的 button,类名叫啥啊?就是粉色的那个,也不知道他本来是什么元素,只能大致猜测是按钮。
o_myWebImageViewList = super.ReturnDriver().findElementsByAndroidUIAutomator("new UiSelector().clickable(true)");
这样写获得了一个 Object,但是之后 click 不好使。
#12 楼 @eric 就是运行 setup 之后,测试代码根本进不去。直接就停止了。
appium 的日志是
info: Getting focused package and activity
info: Device launched! Ready for commands
info: Setting command timeout to the default of 7200 secs
info: Appium session started with sessionId 47e9b6a9-93ef-4d8c-a8b4-9e5edd601843
POST /wd/hub/session 303 6688ms - 9b
debug: Appium request initiated at /wd/hub/session/47e9b6a9-93ef-4d8c-a8b4-9e5edd601843
info: Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.3","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"warnings":{},"desired":{"platformVersion":"4.3","app":"/Users/di_zhou/Documents/workspace/AppiumDemo/apps/ContactManager.apk","platformName":"Android","deviceName":"Android","appActivity":".ContactManager","appPackage":"com.example.android.contactmanager"},"app":"/Users/di_zhou/Documents/workspace/AppiumDemo/apps/ContactManager.apk","platformName":"Android","deviceName":"Android","appActivity":".ContactManager","appPackage":"com.example.android.contactmanager"},"sessionId":"47e9b6a9-93ef-4d8c-a8b4-9e5edd601843"}
debug: Request received with params: {}
GET /wd/hub/session/47e9b6a9-93ef-4d8c-a8b4-9e5edd601843 200 2ms - 857b
是不是超时了?最开始设置有问题?
#5 楼 @cy_suncheng Appium import webdriver 这句话是什么意思啊!我刚接触 Appium,我看网上的代码都有 public class WebDriver extends RemoteWebDriver implements HasTouchScreen{}这个重写还是什么。AppiumDriver 也需要吗?
#6 楼 @eric 根据大神们的指导 我找到了那个库 并加入了自定义用户库里面,但是我的代码还是不好,以前的 WebDriver 可以运行,但是用 AppiumDriver 以后,就运行不了了。走到测试函数,就出现运行错误,但是 Appium 里面没有啥提示。是我的配置不对了吗?我已经把 java client 库加了进来,以前 selenium 里面需要改动吗?
package jp.dwango.music.appium;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.*;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import java.io.File;
import java.net.URL;
import java.util.List;
public class CMyAppium {
private AppiumDriver driver;
@Before
public void setUp() throws Exception {
File appDir = new File("/Users/di_zhou/Documents/workspace/MusicStoreAppiumTest/apps");
File app = new File(appDir,"MusicStore.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("deviceName", "Galaxy S4");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "4.3");
capabilities.setCapability("app", app.getAbsolutePath());
driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
@After
public void tearDown() throws Exception {
//Delete the WebDriver object
driver.quit();
}
@Test
public void testClickDashBoardTest()
{
driver.sendKeyEvent(4);
}
}