Nachricht: Die angeforderte Ressource konnte nicht gefunden werden oder es wurde eine Anfrage mit einer HTTP-Methode empJava

Java-Forum
Anonymous
 Nachricht: Die angeforderte Ressource konnte nicht gefunden werden oder es wurde eine Anfrage mit einer HTTP-Methode emp

Post by Anonymous »

Ich starte den Appium-Server ohne Verwendung von cmd und der Desktop-App und habe dafür Code geschrieben, aber nachdem ich diesen Code ausgeführt habe, ist diese Ausnahme aufgetreten

Code: Select all

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 404. Message: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
Host info: host: 'DESKTOP-SUFA48T', ip: '192.168.0.177'
Build info: version: '4.6.0', revision: '79f1c02ae20'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.8.1'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[{appium:app=C:\Users\HP\Mobile Testing\MobileTestingAppium\src\test\java\resources\ApiDemos-debug.apk, appium:automationName=UiAutomator2, appium:deviceName=Pixel 2 API 28, platformName=ANDROID}], desiredCapabilities=Capabilities {app: C:\Users\HP\Mobile Testing\..., automationName: UiAutomator2, deviceName: Pixel 2 API 28, platformName: ANDROID}}]
Capabilities {}
Ich verwende einen Android-Emulator und führe darauf eine App aus
Image

Code: Select all

@Test
public void config() throws MalformedURLException {

AppiumDriverLocalService service = new AppiumServiceBuilder()
.withAppiumJS(
new File("C:\\Users\\HP\\AppData\\Roaming\\npm\\node_modules\\appium\\build\\lib\\main.js"))
.withIPAddress("127.0.0.1").usingPort(4723).withTimeout(Duration.ofSeconds(300)).build();

service.start();

// Construct the complete URL with the custom base path
URL link = new URL("http://127.0.0.1:4723/wd/hub");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Pixel 2 API 28");
capabilities.setCapability(MobileCapabilityType.APP,
"C:\\Users\\HP\\Mobile Testing\\MobileTestingAppium\\src\\test\\java\\resources\\ApiDemos-debug.apk");
capabilities.setCapability("automationName", "UiAutomator2"); // for Android

AndroidDriver driver = new AndroidDriver(link, capabilities);

driver.quit();

}
Das ist mein Code
Bitte lösen Sie dieses Problem
Vielen Dank im Voraus

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post