Весь проект копировать, наверное, смысла нет. и так портянка получилась знатная )))
package example;
import junitparams.JUnitParamsRunner;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.Select;
import java.util.List;
@RunWith(JUnitParamsRunner.class)
public class Logic {
public static WebDriver driver;
public static Page page;
@BeforeClass
public static void beforClass() {
page = new Page(driver);
}
@Before
public void beforTest() {
ChromeOptions options = new ChromeOptions();
// options.setCapability(CapabilityType.PAGE_LOAD_STRATEGY, “normal”);// none, eager, normal
options.addArguments(“headless”);
options.addArguments(“disable-gpu”);
// options.addArguments(“no-sandbox”);
// options.addArguments(“disable-extensions”);
options.addArguments(“window-size=2000,2000”);
System.setProperty(“webdriver.chrome.driver”, “E:\Selenium\chromedriver_win32\chromedriver.exe”);
driver = new ChromeDriver(options);
page = new Page(driver);
// IgnoreSsl.ignoreCertificate();
}
@After
public void afterTest() {
driver.quit();
}
public void redact() {
for (int i = 0; i < 10000; i++) {
driver.get(“https://127.0.0.1/sport/administrator/index.php”);
// page.screen();
page.wait10secElementToBeClickableAndSendKeys(page.login, “Логин”);
page.wait10secElementToBeClickableAndSendKeys(page.password, “Пароль”);
page.wait10secElementToBeClickableAndClick(page.enter);
page.wait10secElementToBeClickableAndClick(page.components);
page.wait10secElementToBeClickableAndClick(page.joomShopping);
page.wait10secElementToBeClickableAndClick(page.goods);
page.wait10secElementToBeClickableAndClick(page.view);
page.wait10secElementToBeClickableAndClick(page.notview);
page.wait10secElementToBeClickableAndClick(page.firstgood);
page.wait10secElementToBeClickableClearSendkeysEnter(page.aliasgood, page.namegood.getAttribute(“value”));
// Переходим в Инфо о товаре
page.wait10secElementToBeClickableAndClick(page.infogood);
page.wait10secElementevisibilityOf(page.waitinfogood);
Select selectcat2 = new Select(page.selectcategory);
selectcat2.selectByIndex(1);
Ошибки:
E:\SSD\Java\jdk1.8.0_181\bin\java.exe -ea -javaagent:C:\Users\al198.m2\repository/org/aspectj/aspectjweaver/1.9.1/aspectjweaver-1.9.1.jar -Didea.test.cyclic.buffer.size=1048576 “-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1.4\lib\idea_rt.jar=54880:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1.4\bin” -Dfile.encoding=UTF-8 -classpath “C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1.4\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1.4\plugins\junit\lib\junit-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1.4\plugins\junit\lib\junit5-rt.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\charsets.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\deploy.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\ext\access-bridge-64.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\ext\cldrdata.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\ext\dnsns.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\ext\jaccess.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\ext\jfxrt.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\ext\localedata.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\ext\nashorn.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\ext\sunec.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\ext\sunjce_provider.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\ext\sunmscapi.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\ext\sunpkcs11.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\ext\zipfs.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\javaws.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\jce.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\jfr.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\jfxswt.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\jsse.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\management-agent.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\plugin.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\resources.jar;E:\SSD\Java\jdk1.8.0_181\jre\lib\rt.jar;E:\Selenium\sportschools\target\test-classes;C:\Users\al198.m2\repository\com\microsoft\sqlserver\mssql-jdbc\6.4.0.jre8\mssql-jdbc-6.4.0.jre8.jar;C:\Users\al198.m2\repository\mysql\mysql-connector-java\8.0.11\mysql-connector-java-8.0.11.jar;C:\Users\al198.m2\repository\com\google\protobuf\protobuf-java\2.6.0\protobuf-java-2.6.0.jar;C:\Users\al198.m2\repository\io\qameta\allure\allure-junit5\2.6.0\allure-junit5-2.6.0.jar;C:\Users\al198.m2\repository\io\qameta\allure\allure-java-commons\2.6.0\allure-java-commons-2.6.0.jar;C:\Users\al198.m2\repository\io\qameta\allure\allure2-model-api\1.0-BETA6\allure2-model-api-1.0-BETA6.jar;C:\Users\al198.m2\repository\io\qameta\allure\allure2-model-pojo\1.0-BETA6\allure2-model-pojo-1.0-BETA6.jar;C:\Users\al198.m2\repository\org\apache\tika\tika-core\1.14\tika-core-1.14.jar;C:\Users\al198.m2\repository\io\qameta\allure\allure2-model-jackson\1.0-BETA6\allure2-model-jackson-1.0-BETA6.jar;C:\Users\al198.m2\repository\com\fasterxml\jackson\module\jackson-module-jaxb-annotations\2.7.0\jackson-module-jaxb-annotations-2.7.0.jar;C:\Users\al198.m2\repository\org\apache\commons\commons-lang3\3.5\commons-lang3-3.5.jar;C:\Users\al198.m2\repository\org\aspectj\aspectjrt\1.8.10\aspectjrt-1.8.10.jar;C:\Users\al198.m2\repository\org\jooq\joor\0.9.6\joor-0.9.6.jar;C:\Users\al198.m2\repository\io\qameta\allure\allure-junit-platform\2.6.0\allure-junit-platform-2.6.0.jar;C:\Users\al198.m2\repository\org\junit\jupiter\junit-jupiter-api\5.0.0\junit-jupiter-api-5.0.0.jar;C:\Users\al198.m2\repository\org\opentest4j\opentest4j\1.0.0\opentest4j-1.0.0.jar;C:\Users\al198.m2\repository\org\junit\platform\junit-platform-commons\1.0.0\junit-platform-commons-1.0.0.jar;C:\Users\al198.m2\repository\org\junit\platform\junit-platform-launcher\1.0.0\junit-platform-launcher-1.0.0.jar;C:\Users\al198.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.0.0\junit-jupiter-engine-5.0.0.jar;C:\Users\al198.m2\repository\org\apiguardian\apiguardian-api\1.0.0\apiguardian-api-1.0.0.jar;C:\Users\al198.m2\repository\org\junit\platform\junit-platform-engine\1.0.0\junit-platform-engine-1.0.0.jar;C:\Users\al198.m2\repository\org\seleniumhq\selenium\selenium-java\3.14.0\selenium-java-3.14.0.jar;C:\Users\al198.m2\repository\org\seleniumhq\selenium\selenium-api\3.14.0\selenium-api-3.14.0.jar;C:\Users\al198.m2\repository\org\seleniumhq\selenium\selenium-chrome-driver\3.14.0\selenium-chrome-driver-3.14.0.jar;C:\Users\al198.m2\repository\org\seleniumhq\selenium\selenium-edge-driver\3.14.0\selenium-edge-driver-3.14.0.jar;C:\Users\al198.m2\repository\org\seleniumhq\selenium\selenium-firefox-driver\3.14.0\selenium-firefox-driver-3.14.0.jar;C:\Users\al198.m2\repository\org\seleniumhq\selenium\selenium-ie-driver\3.14.0\selenium-ie-driver-3.14.0.jar;C:\Users\al198.m2\repository\org\seleniumhq\selenium\selenium-opera-driver\3.14.0\selenium-opera-driver-3.14.0.jar;C:\Users\al198.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\3.14.0\selenium-remote-driver-3.14.0.jar;C:\Users\al198.m2\repository\org\seleniumhq\selenium\selenium-safari-driver\3.14.0\selenium-safari-driver-3.14.0.jar;C:\Users\al198.m2\repository\org\seleniumhq\selenium\selenium-support\3.14.0\selenium-support-3.14.0.jar;C:\Users\al198.m2\repository\net\bytebuddy\byte-buddy\1.8.15\byte-buddy-1.8.15.jar;C:\Users\al198.m2\repository\org\apache\commons\commons-exec\1.3\commons-exec-1.3.jar;C:\Users\al198.m2\repository\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;C:\Users\al198.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\al198.m2\repository\com\google\guava\guava\25.0-jre\guava-25.0-jre.jar;C:\Users\al198.m2\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;C:\Users\al198.m2\repository\org\checkerframework\checker-compat-qual\2.0.0\checker-compat-qual-2.0.0.jar;C:\Users\al198.m2\repository\com\google\errorprone\error_prone_annotations\2.1.3\error_prone_annotations-2.1.3.jar;C:\Users\al198.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;C:\Users\al198.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.14\animal-sniffer-annotations-1.14.jar;C:\Users\al198.m2\repository\org\apache\httpcomponents\httpclient\4.5.5\httpclient-4.5.5.jar;C:\Users\al198.m2\repository\org\apache\httpcomponents\httpcore\4.4.9\httpcore-4.4.9.jar;C:\Users\al198.m2\repository\com\squareup\okhttp3\okhttp\3.10.0\okhttp-3.10.0.jar;C:\Users\al198.m2\repository\com\squareup\okio\okio\1.14.1\okio-1.14.1.jar;C:\Users\al198.m2\repository\pl\pragmatists\JUnitParams\1.1.1\JUnitParams-1.1.1.jar;C:\Users\al198.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\al198.m2\repository\ru\yandex\qatools\ashot\ashot\1.5.4\ashot-1.5.4.jar;C:\Users\al198.m2\repository\commons-io\commons-io\2.5\commons-io-2.5.jar;C:\Users\al198.m2\repository\com\google\code\gson\gson\2.6.2\gson-2.6.2.jar;C:\Users\al198.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\al198.m2\repository\net\lightbody\bmp\browsermob-core\2.1.5\browsermob-core-2.1.5.jar;C:\Users\al198.m2\repository\net\lightbody\bmp\littleproxy\1.1.0-beta-bmp-17\littleproxy-1.1.0-beta-bmp-17.jar;C:\Users\al198.m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.9\jackson-core-2.8.9.jar;C:\Users\al198.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.9\jackson-databind-2.8.9.jar;C:\Users\al198.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.9\jackson-annotations-2.8.9.jar;C:\Users\al198.m2\repository\dnsjava\dnsjava\2.1.8\dnsjava-2.1.8.jar;C:\Users\al198.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\al198.m2\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;C:\Users\al198.m2\repository\com\jcraft\jzlib\1.1.3\jzlib-1.1.3.jar;C:\Users\al198.m2\repository\io\netty\netty-all\4.0.51.Final\netty-all-4.0.51.Final.jar;C:\Users\al198.m2\repository\org\bouncycastle\bcprov-jdk15on\1.58\bcprov-jdk15on-1.58.jar;C:\Users\al198.m2\repository\org\bouncycastle\bcpkix-jdk15on\1.58\bcpkix-jdk15on-1.58.jar;C:\Users\al198.m2\repository\net\lightbody\bmp\mitm\2.1.5\mitm-2.1.5.jar” com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 example.Test1,test1_2
Starting ChromeDriver 2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e) on port 44205
Only local connections are allowed.
авг 06, 2018 6:57:29 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: Proxy element for: DefaultElementLocator ‘By.id: mod-login-username’ (tried for 60 second(s) with 500 milliseconds interval)
at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:113)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:283)
at global.GlobalPage.wait10secElementToBeClickableAndSendKeys(GlobalPage.java:35)
at example.Logic.redact(Logic.java:54)
at example.Test1.test1_2(Test1.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at junitparams.JUnitParamsRunner.runChild(JUnitParamsRunner.java:449)
at junitparams.JUnitParamsRunner.runChild(JUnitParamsRunner.java:393)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {“method”:“id”,“selector”:“mod-login-username”}
(Session info: headless chrome=68.0.3440.84)
(Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
For documentation on this error, please visit: Selenium
Build info: version: ‘3.14.0’, revision: ‘aacccce0’, time: ‘2018-08-02T20:19:58.91Z’
System info: host: ‘DESKTOP-OKFHBO9’, ip: ‘192.168.2.38’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.41.578737 (49da6702b16031…, userDataDir: E:\SSD\TMP\Tmp\scoped_dir40…}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:54894}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 68.0.3440.84, webStorageEnabled: true}
Session ID: 5ded0c079790bd1f301bd0e7b19ff1e4
*** Element info: {Using=id, value=mod-login-username}
at sun.reflect.GeneratedConstructorAccessor13.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:322)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:368)
at org.openqa.selenium.By$ById.findElement(By.java:188)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:314)
at org.openqa.selenium.support.pagefactory.DefaultElementLocator.findElement(DefaultElementLocator.java:69)
at org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:38)
at com.sun.proxy.$Proxy11.isDisplayed(Unknown Source)
at org.openqa.selenium.support.ui.ExpectedConditions.elementIfVisible(ExpectedConditions.java:315)
at org.openqa.selenium.support.ui.ExpectedConditions.access$100(ExpectedConditions.java:44)
at org.openqa.selenium.support.ui.ExpectedConditions$10.apply(ExpectedConditions.java:301)
at org.openqa.selenium.support.ui.ExpectedConditions$10.apply(ExpectedConditions.java:298)
at org.openqa.selenium.support.ui.ExpectedConditions$23.apply(ExpectedConditions.java:686)
at org.openqa.selenium.support.ui.ExpectedConditions$23.apply(ExpectedConditions.java:682)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:260)
… 29 more
Process finished with exit code -1