在Eclipse中找不到带有Appium的构造函数AndroidDriver

时间:2019-05-31 21:11:43

标签: java android appium appium-android

错误代码:

Sub Upload_Excel_to_AccessUPDATE()

Dim wbpath As String

wbpath = Application.ActiveWorkbook.Path


Dim con As Object  '' ADODB.Connection
Set con = CreateObject("ADODB.Connection")  '' New ADODB.Connection
con.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data source=\\an\HRS SD Performance Data\Capacity DB.accdb;"
con.Execute _
         "UPDATE AssigenedVol_tbl " & _
            "SET Volume = Volume " & _
            "WHERE ID_Unique = ID_Unique " & _
            "FROM [Excel 12.0 Xml;HDR=YES;IMEX=2;ACCDB=YES;DATABASE=C:\Users\leg\Desktop\DB Macro Test.xlsm].[rawdata$]"
con.Close
Set con = Nothing
End Sub

消息错误是:

  
      
  • 构造函数URL(字符串)未定义
  •   
  • 未定义构造函数AndroidDriver(URL,DesiredCapabilities)
  •   
  • AndroidDriver是原始类型
  •   

我尝试使用不同版本的java-client,但问题仍然存在

2 个答案:

答案 0 :(得分:1)

您需要使用现有的构造函数,如下所示:

https://appium.github.io/java-client/io/appium/java_client/android/AndroidDriver.html

您需要使用java.net.URL而不是com.gargoylesoftware.htmlunit.javascript.host.URL

答案 1 :(得分:0)

@Lorena,你好。
1.首先,请您仔细检查一下进口吗?与正确的人共享下面的代码片段

package tests.web;

import java.net.MalformedURLException;
import java.net.URL;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileBrowserType;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
public class AndroidWebTest {
   private static final String ACCESS_KEY = System.getenv(“SEETEST_IO_ACCESS_KEY”);
   private static final String CLOUD_URL = “https://cloud.seetest.io:443/wd/hub”;
   private static final String TITLE = “Testing Website on Android Chrome with Java”;
   private AndroidDriver driver = null;

   @Before
   public void setUp() throws MalformedURLException {
       DesiredCapabilities dc = new DesiredCapabilities();
       dc.setCapability(“testName”, TITLE);
       dc.setCapability(“accessKey”, ACCESS_KEY);
       dc.setBrowserName(MobileBrowserType.CHROME);
       driver = new AndroidDriver(new URL(CLOUD_URL), dc);
   }

   @Test
   public void testAppiumOnChrome() {
       driver.get(“https://amazon.com”);
       System.out.println(driver.getTitle());
       if (driver.getCapabilities().getCapability(“device.category”).equals(“TABLET”)) {
           driver.findElement(By.xpath(“//*[@name=’field-keywords’]”)).sendKeys(“iPhone”);
           driver.findElement(By.xpath(“//*[@text=’Go’]”)).click();
       } else {
           driver.findElement(By.xpath(“//*[@name=’k’]”)).sendKeys(“iPhone”);
           driver.findElement(By.xpath(“//*[@value=’Go’]”)).click();
       }
   }

   @After
   public void tearDown() {
       if (driver != null) {
           driver.quit();
       }
   }
}

有关更多详细信息,请参见Comparing and combining web and mobile test automation drivers文章。

  1. 如果您的项目是基于Maven的,是否还可以再次检查依赖项? 例如,请查看最新的appium更新here enter image description here

适当的Maven存储库以检查(最新的)Java客户端: https://mvnrepository.com/artifact/io.appium/java-client