下面的代码在设置位置有一个错误。为什么这个错误会出现? 。错误如下:
There is an error in the public void Setup().
The error is The method Setup() is undefined for the type jammytestappium.
执行代码时会造成伤害。
我的代码如下:
package com.example.jamappium;
import java.net.MalformedURLException;
import java.net.URL;
import java.sql.Driver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.server.handler.FindElement;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.sun.jna.platform.win32.SetupApi;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.AndroidMobileCapabilityType;
import io.appium.java_client.remote.MobileCapabilityType;
public class Jammytestappium {
{
AndroidDriver<WebElement> abcd;
@BeforeClass
public void setup()
{
DesiredCapabilities test=new DesiredCapabilities();
test.setCapability(AndroidMobileCapabilityType.APP_PACKAGE,
"com.veronicapps.veronica.simplecalculator");
test.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY,
"com.veronicapps.veronica.simplecalculator.MainActivity");
test.setCapability(MobileCapabilityType.VERSION, "4.2.2");
test.setCapability(MobileCapabilityType.DEVICE_NAME, "emulator");
abcd = (AndroidDriver) new RemoteWebDriver(new URL(
"http://127.0.0.1:4723/wd/hub"),test);
}
}
答案 0 :(得分:1)
尝试删除&#34;公共类jammytestappium {&#34;
之后的额外大括号