org.apache.poi
poi-ooxml
5.2.2
org.apache.poi
poi
5.2.2
io.github.bonigarcia
webdrivermanager
5.1.1
org.apache.maven.plugins
maven-compiler-plugin
3.10.1
maven-plugin
log4j
log4j
1.2.17
com.aventstack
extentreports
3.0.0
io.qameta.allure
allure-testng
2.18.1
log4j
log4j
1.2.17
org.apache.pdfbox
pdfbox
2.0.26
org.json
json
20220320
com.sun.mail
javax.mail
1.6.2
org.aspectj
aspectjweaver
1.9.9.1
runtime
commons-logging
commons-logging
1.2
io.cucumber
cucumber-java
7.8.1
io.cucumber
cucumber-testng
7.8.1
io.cucumber
cucumber-jvm-deps
1.0.6
provided
**Это мой класс бегуна:
**
Код: Выделить всё
package mobilerunner;
import java.net.MalformedURLException;
import org.apache.log4j.PropertyConfigurator;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import commonuseractions.CommonActionMethods;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.options.UiAutomator2Options;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import mobile_pageobjects.SauceLab.Login_Page;
import utils.DriverFactory;
public class SauceLab_Aroon extends CommonActionMethods{
@BeforeClass
public static void setUp() throws MalformedURLException {
PropertyConfigurator.configure(configFilename);
UiAutomator2Options opt = new UiAutomator2Options()
.setApp("D:\\Mobile Automation\\APK\\Android.SauceLabs.Mobile.Sample.app.2.7.1.apk")
.setAppActivity("com.swaglabsmobileapp.MainActivity")
.setAppPackage("com.swaglabsmobileapp")
.setAutomationName("UiAutomator2")
.setDeviceName("Pixel 2 XL API 31")
.eventTimings();
appDriver = new AndroidDriver(new java.net.URL("http://127.0.0.1:4723/wd/hub/"),opt);
DriverFactory.setDriver(appDriver);
}
@Test
public void test1() throws Exception {
new Login_Page().logIn();
}
@AfterClass
public void tearDown() {
}
}
**
Код: Выделить всё
package mobile_pageobjects.SauceLab;
import java.time.Duration;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.PageFactory;
import commonuseractions.CommonActionMethods;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;
public class Login_Page extends CommonActionMethods{
@AndroidFindBy(accessibility = "test-Username")
@CacheLookup
WebElement userName;
public Login_Page() {
// PageFactory.initElements(new AppiumFieldDecorator(appDriver,Duration.ofSeconds(15)), this);
PageFactory.initElements(appDriver, this);
}
public void logIn() throws Exception {
Thread.sleep(15000);
clickMethod(userName," UserName input field ");
}
}
org.openqa.selenium.InvalidSelectorException: неподдерживаемый селектор CSS '< em>[name='userName']'. Причина: «Ошибка: «имя» не является допустимым атрибутом. Поддерживаемые атрибуты: «проверяемый, проверенный, кликабельный, включенный, фокусируемый, сфокусированный, долгий клик, прокручиваемый, выбранный, индекс, экземпляр, описание, идентификатор ресурса, текст, имя класса, имя пакета».
Для документацию по этой ошибке посетите: https://selenium.dev/Exceptions/#invali ... _Exception
Информация о сборке: версия: '4.7.1', редакция: 'c6795baf1a3'
Информация о системе: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.3'
Информация о драйвере : io.appium.java_client.android.AndroidDriver
Команда: [d0d24b81-2280-4c6d-9692-afc0af6b9bf9, findElement {using=css selector, value=[name='userName']}]
Возможности {appium:app: D:\Mobile Automation\APK \An..., appium:appActivity: com.swaglabsmobileapp.MainA..., appium:appPackage: com.swaglabsmobileapp, appium:automationName: UiAutomator2, appium:databaseEnabled: false, appium:desired: {app: D:\Mobile Automation\APK\An..., appActivity: com.swaglabsmobileapp.MainA... , appPackage: com.swaglabsmobileapp, AutomationName: UiAutomator2, имя устройства: Pixel 2 XL API 31, eventTimes: true, PlatformName: android}, appium:deviceApiLevel: 31, appium:deviceManufacturer: Google, appium:deviceModel: sdk_gphone64_x86_64, appium:deviceName: emulator-5554, appium:deviceScreenDensity: 560, appium:deviceScreenSize: 1440x2880, appium:deviceUDID: emulator-5554, appium:eventTimings: true, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:pixelRatio: 3.5, appium:platformVersion: 12, appium:statBarHeight: 84, appium:takesScreenshot: true, appium:viewportRect: {height: 2628, left: 0, top: 84, width: 1440}, appium:warnings: {}, appium:webStorageEnabled: false, PlatformName: ANDROID
Session ИДЕНТИФИКАТОР: d0d24b81-2280-4c6d-9692-afc0af6b9bf9
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
на java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
на org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:200)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:133)в org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:53)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:184)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:262)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:551)
at org.openqa.selenium.remote.ElementLocation$ElementFinder$2.findElement(ElementLocation.java:162)
at org.openqa.selenium.remote.ElementLocation.findElement(ElementLocation.java:60)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:367)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:359)
at org.openqa.selenium.By$PreW3CLocator.findElement(By.java:429)
at org.openqa.selenium.By$ByName.findElement(By.java:238)
at org.openqa.selenium.support.ByIdOrName.findElement(ByIdOrName.java:50)
at org.openqa.selenium.remote.ElementLocation$ElementFinder$1.findElement(ElementLocation.java:136)
at org.openqa.selenium.remote.ElementLocation.findElement(ElementLocation.java:80)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:367)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:359)
at org.openqa.selenium.support.pagefactory.DefaultElementLocator.findElement(DefaultElementLocator.java:70)
at org.openqa.selenium.support.pagefactory.internal.LocationElementHandler.invoke(LocationElementHandler.java:39)
at jdk.proxy2/jdk.proxy2.$Proxy20.click(Unknown Source)
at commonuseractions.CommonActionMethods.clickMethod(CommonActionMethods.java:145)
на mobile_pageobjects.SauceLab.Login_Page.logIn(Login_Page.java:27)
на mobilerunner.SauceLab_Aroon.test1(SauceLab_Aroon.java:38)
в java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(собственный метод)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
на java.base/java.lang.reflect.Method.invoke(Method.java:568)
Подробнее здесь: https://stackoverflow.com/questions/747 ... ector-name
Мобильная версия