├── logs
├── debug.log.2017-07-05
├── debug.log.2017-07-21
├── error.log
└── error.log.2017-07-21
├── chinese.md
├── chanelog.md
├── img
├── result.PNG
├── result2.PNG
└── result3.PNG
├── target
├── maven-status
│ └── maven-compiler-plugin
│ │ ├── testCompile
│ │ └── default-testCompile
│ │ │ ├── inputFiles.lst
│ │ │ └── createdFiles.lst
│ │ └── compile
│ │ └── default-compile
│ │ ├── createdFiles.lst
│ │ └── inputFiles.lst
├── surefire-reports
│ ├── old
│ │ ├── TesterHome
│ │ │ ├── groups.html
│ │ │ ├── reporter-output.html
│ │ │ ├── 登录.properties
│ │ │ ├── 社区.properties
│ │ │ ├── methods-not-run.html
│ │ │ ├── main.html
│ │ │ ├── index.html
│ │ │ ├── toc.html
│ │ │ ├── testng.xml.html
│ │ │ ├── classes.html
│ │ │ ├── methods.html
│ │ │ └── methods-alphabetical.html
│ │ ├── wiseoper
│ │ │ ├── groups.html
│ │ │ ├── reporter-output.html
│ │ │ ├── 登录.properties
│ │ │ ├── 账号延期.properties
│ │ │ ├── methods-not-run.html
│ │ │ ├── main.html
│ │ │ ├── index.html
│ │ │ ├── toc.html
│ │ │ ├── testng.xml.html
│ │ │ ├── classes.html
│ │ │ ├── methods.html
│ │ │ └── methods-alphabetical.html
│ │ └── index.html
│ ├── failed.png
│ ├── passed.png
│ ├── skipped.png
│ ├── bullet_point.png
│ ├── collapseall.gif
│ ├── navigator-bullet.png
│ ├── testng.css
│ ├── wiseoper
│ │ ├── 登录.xml
│ │ ├── testng-failed.xml
│ │ ├── 登录.html
│ │ ├── 账号延期.xml
│ │ └── 账号延期.html
│ ├── TesterHome
│ │ ├── 登录.xml
│ │ ├── 社区.xml
│ │ ├── testng-failed.xml
│ │ ├── 登录.html
│ │ └── 社区.html
│ ├── junitreports
│ │ ├── TEST-test.LoginTest.xml
│ │ ├── TEST-test.LoginPageTest.xml
│ │ ├── TEST-com.shark.selenium.LoginPageTest.xml
│ │ ├── TEST-com.shark.selenium.MyinfoPageTest.xml
│ │ ├── TEST-test.MyinfoPageTest.xml
│ │ └── TEST-test.ApplyContinueTest.xml
│ ├── 2017-05-23T16-53-16_878-jvmRun1.dumpstream
│ ├── testng-failed.xml
│ ├── TestSuite.txt
│ ├── testng-reports.js
│ ├── emailable-report.html
│ └── testng-reports.css
├── classes
│ ├── model
│ │ ├── TestCase.class
│ │ └── CheckPoint.class
│ ├── test
│ │ ├── LoginTest.class
│ │ ├── MyinfoPageTest.class
│ │ ├── ApplyContinueTest.class
│ │ └── CommunityPageTest.class
│ ├── util
│ │ ├── MatchMode.class
│ │ ├── WebBrower.class
│ │ ├── YamlRead.class
│ │ ├── TestMonitor.class
│ │ ├── ElementLocator.class
│ │ ├── ExtentManager.class
│ │ ├── OperateElement.class
│ │ ├── DirectElementLocator.class
│ │ ├── SeleniumElementLocator.class
│ │ └── ExtentTestNGIReporterListener.class
│ ├── browser
│ │ ├── ComboBox.class
│ │ ├── BrowserType.class
│ │ ├── TestBaseSetup.class
│ │ └── TestBaseSetup1.class
│ ├── pageobjects
│ │ ├── LoginPage.class
│ │ ├── MyInfoPage.class
│ │ ├── CommunityPage.class
│ │ └── ApplyContinuePage.class
│ ├── MyInfo.yaml
│ ├── Community.yaml
│ ├── LoginFail.yaml
│ ├── Login.yaml
│ └── ApplyContinue1.yaml
└── test-classes
│ ├── surefire-junit4-2.20.jar
│ └── testng.xml
├── res
├── log4j.properties
└── testng.xml
├── src
└── main
│ ├── java
│ ├── util
│ │ ├── MatchMode.java
│ │ ├── YamlRead.java
│ │ ├── ExtentManager.java
│ │ ├── WebBrower.java
│ │ ├── TestMonitor.java
│ │ ├── ExtentTestNGIReporterListener.java
│ │ ├── ElementLocator.java
│ │ └── OperateElement.java
│ ├── browser
│ │ ├── BrowserType.java
│ │ ├── ComboBox.java
│ │ ├── TestBaseSetup1.java
│ │ └── TestBaseSetup.java
│ ├── model
│ │ ├── CheckPoint.java
│ │ └── TestCase.java
│ ├── test
│ │ ├── CommunityPageTest.java
│ │ ├── MyinfoPageTest.java
│ │ ├── ApplyContinueTest.java
│ │ └── LoginTest.java
│ └── pageobjects
│ │ ├── MyInfoPage.java
│ │ ├── CommunityPage.java
│ │ ├── LoginPage.java
│ │ └── ApplyContinuePage.java
│ └── resources
│ ├── MyInfo.yaml
│ ├── Community.yaml
│ ├── LoginFail.yaml
│ ├── Login.yaml
│ └── ApplyContinue1.yaml
├── Dockerfile
├── .idea
├── encodings.xml
├── vcs.xml
├── kotlinc.xml
├── modules.xml
├── misc.xml
├── libraries
│ ├── Maven__junit_junit_4_12.xml
│ ├── Maven__org_jsoup_jsoup_1_9_2.xml
│ ├── Maven__org_mongodb_bson_3_3_0.xml
│ ├── Maven__org_testng_testng_6_11.xml
│ ├── Maven__org_w3c_css_sac_1_3.xml
│ ├── Maven__org_yaml_snakeyaml_1_17.xml
│ ├── Maven__xalan_xalan_2_7_2.xml
│ ├── Maven__log4j_log4j_1_2_17.xml
│ ├── Maven__com_beust_jcommander_1_64.xml
│ ├── Maven__net_java_dev_jna_jna_4_1_0.xml
│ ├── Maven__xalan_serializer_2_7_2.xml
│ ├── Maven__cglib_cglib_nodep_3_2_4.xml
│ ├── Maven__com_google_guava_guava_21_0.xml
│ ├── Maven__org_freemarker_freemarker_2_3_23.xml
│ ├── Maven__xml_apis_xml_apis_1_4_01.xml
│ ├── Maven__commons_io_commons_io_2_5.xml
│ ├── Maven__xerces_xercesImpl_2_11_0.xml
│ ├── Maven__org_mongodb_mongodb_driver_3_3_0.xml
│ ├── Maven__com_aventstack_extentreports_3_0_5.xml
│ ├── Maven__com_google_code_gson_gson_2_8_0.xml
│ ├── Maven__org_hamcrest_hamcrest_core_1_3.xml
│ ├── Maven__commons_codec_commons_codec_1_10.xml
│ ├── Maven__org_mongodb_mongodb_driver_core_3_3_0.xml
│ ├── Maven__com_esotericsoftware_yamlbeans_yamlbeans_1_11.xml
│ ├── Maven__org_apache_commons_commons_exec_1_3.xml
│ ├── Maven__net_java_dev_jna_jna_platform_4_1_0.xml
│ ├── Maven__net_sourceforge_htmlunit_htmlunit_2_26.xml
│ ├── Maven__org_apache_commons_commons_lang3_3_5.xml
│ ├── Maven__commons_logging_commons_logging_1_2.xml
│ ├── Maven__com_codeborne_phantomjsdriver_1_4_0.xml
│ ├── Maven__org_apache_httpcomponents_httpcore_4_4_6.xml
│ ├── Maven__org_apache_httpcomponents_httpmime_4_5_3.xml
│ ├── Maven__javax_servlet_javax_servlet_api_3_1_0.xml
│ ├── Maven__net_sourceforge_cssparser_cssparser_0_9_22.xml
│ ├── Maven__org_apache_httpcomponents_httpclient_4_5_3.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_api_3_4_0.xml
│ ├── Maven__net_sourceforge_htmlunit_neko_htmlunit_2_25.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_java_3_4_0.xml
│ ├── Maven__org_seleniumhq_selenium_htmlunit_driver_2_26.xml
│ ├── Maven__org_eclipse_jetty_jetty_io_9_4_1_v20170120.xml
│ ├── Maven__net_sourceforge_htmlunit_htmlunit_core_js_2_26.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_support_3_4_0.xml
│ ├── Maven__org_eclipse_jetty_jetty_http_9_4_3_v20170317.xml
│ ├── Maven__org_eclipse_jetty_jetty_util_9_4_1_v20170120.xml
│ ├── Maven__org_eclipse_jetty_jetty_client_9_4_3_v20170317.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_ie_driver_3_4_0.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_edge_driver_3_4_0.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_opera_driver_3_4_0.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_chrome_driver_3_4_0.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_remote_driver_3_4_0.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_safari_driver_3_4_0.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_firefox_driver_3_4_0.xml
│ ├── Maven__org_eclipse_jetty_websocket_websocket_api_9_4_3_v20170317.xml
│ ├── Maven__org_eclipse_jetty_websocket_websocket_client_9_4_3_v20170317.xml
│ └── Maven__org_eclipse_jetty_websocket_websocket_common_9_4_3_v20170317.xml
└── compiler.xml
├── docker-compose.yml
├── pom.xml
├── README.md
└── selenium_java.iml
/logs/debug.log.2017-07-05:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/logs/debug.log.2017-07-21:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/chinese.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/chinese.md
--------------------------------------------------------------------------------
/chanelog.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/chanelog.md
--------------------------------------------------------------------------------
/img/result.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/img/result.PNG
--------------------------------------------------------------------------------
/img/result2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/img/result2.PNG
--------------------------------------------------------------------------------
/img/result3.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/img/result3.PNG
--------------------------------------------------------------------------------
/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/target/surefire-reports/old/TesterHome/groups.html:
--------------------------------------------------------------------------------
1 |
Groups used for this test run
--------------------------------------------------------------------------------
/target/surefire-reports/old/wiseoper/groups.html:
--------------------------------------------------------------------------------
1 | Groups used for this test run
--------------------------------------------------------------------------------
/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/res/log4j.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/res/log4j.properties
--------------------------------------------------------------------------------
/target/surefire-reports/old/TesterHome/reporter-output.html:
--------------------------------------------------------------------------------
1 | Reporter output
--------------------------------------------------------------------------------
/target/surefire-reports/old/wiseoper/reporter-output.html:
--------------------------------------------------------------------------------
1 | Reporter output
--------------------------------------------------------------------------------
/target/surefire-reports/old/TesterHome/登录.properties:
--------------------------------------------------------------------------------
1 | [SuiteResult context=登录][SuiteResult context=社区]
--------------------------------------------------------------------------------
/target/surefire-reports/old/TesterHome/社区.properties:
--------------------------------------------------------------------------------
1 | [SuiteResult context=登录][SuiteResult context=社区]
--------------------------------------------------------------------------------
/target/surefire-reports/old/wiseoper/登录.properties:
--------------------------------------------------------------------------------
1 | [SuiteResult context=登录][SuiteResult context=账号延期]
--------------------------------------------------------------------------------
/target/surefire-reports/old/wiseoper/账号延期.properties:
--------------------------------------------------------------------------------
1 | [SuiteResult context=登录][SuiteResult context=账号延期]
--------------------------------------------------------------------------------
/target/surefire-reports/old/TesterHome/methods-not-run.html:
--------------------------------------------------------------------------------
1 | Methods that were not run
--------------------------------------------------------------------------------
/target/surefire-reports/old/wiseoper/methods-not-run.html:
--------------------------------------------------------------------------------
1 | Methods that were not run
--------------------------------------------------------------------------------
/target/classes/model/TestCase.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/model/TestCase.class
--------------------------------------------------------------------------------
/target/classes/test/LoginTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/test/LoginTest.class
--------------------------------------------------------------------------------
/target/classes/util/MatchMode.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/util/MatchMode.class
--------------------------------------------------------------------------------
/target/classes/util/WebBrower.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/util/WebBrower.class
--------------------------------------------------------------------------------
/target/classes/util/YamlRead.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/util/YamlRead.class
--------------------------------------------------------------------------------
/target/surefire-reports/failed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/surefire-reports/failed.png
--------------------------------------------------------------------------------
/target/surefire-reports/passed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/surefire-reports/passed.png
--------------------------------------------------------------------------------
/target/surefire-reports/skipped.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/surefire-reports/skipped.png
--------------------------------------------------------------------------------
/target/classes/browser/ComboBox.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/browser/ComboBox.class
--------------------------------------------------------------------------------
/target/classes/model/CheckPoint.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/model/CheckPoint.class
--------------------------------------------------------------------------------
/target/classes/util/TestMonitor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/util/TestMonitor.class
--------------------------------------------------------------------------------
/target/classes/browser/BrowserType.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/browser/BrowserType.class
--------------------------------------------------------------------------------
/target/classes/test/MyinfoPageTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/test/MyinfoPageTest.class
--------------------------------------------------------------------------------
/target/classes/util/ElementLocator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/util/ElementLocator.class
--------------------------------------------------------------------------------
/target/classes/util/ExtentManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/util/ExtentManager.class
--------------------------------------------------------------------------------
/target/classes/util/OperateElement.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/util/OperateElement.class
--------------------------------------------------------------------------------
/target/surefire-reports/bullet_point.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/surefire-reports/bullet_point.png
--------------------------------------------------------------------------------
/target/surefire-reports/collapseall.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/surefire-reports/collapseall.gif
--------------------------------------------------------------------------------
/target/classes/browser/TestBaseSetup.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/browser/TestBaseSetup.class
--------------------------------------------------------------------------------
/target/classes/pageobjects/LoginPage.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/pageobjects/LoginPage.class
--------------------------------------------------------------------------------
/target/classes/browser/TestBaseSetup1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/browser/TestBaseSetup1.class
--------------------------------------------------------------------------------
/target/classes/pageobjects/MyInfoPage.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/pageobjects/MyInfoPage.class
--------------------------------------------------------------------------------
/target/classes/test/ApplyContinueTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/test/ApplyContinueTest.class
--------------------------------------------------------------------------------
/target/classes/test/CommunityPageTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/test/CommunityPageTest.class
--------------------------------------------------------------------------------
/target/surefire-reports/navigator-bullet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/surefire-reports/navigator-bullet.png
--------------------------------------------------------------------------------
/target/test-classes/surefire-junit4-2.20.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/test-classes/surefire-junit4-2.20.jar
--------------------------------------------------------------------------------
/src/main/java/util/MatchMode.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | public enum MatchMode
4 | {
5 | ExactMatch,
6 | PartialMatch,
7 | RegexMatch;
8 | }
--------------------------------------------------------------------------------
/target/classes/pageobjects/CommunityPage.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/pageobjects/CommunityPage.class
--------------------------------------------------------------------------------
/target/classes/util/DirectElementLocator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/util/DirectElementLocator.class
--------------------------------------------------------------------------------
/target/classes/pageobjects/ApplyContinuePage.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/pageobjects/ApplyContinuePage.class
--------------------------------------------------------------------------------
/target/classes/util/SeleniumElementLocator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/util/SeleniumElementLocator.class
--------------------------------------------------------------------------------
/target/classes/util/ExtentTestNGIReporterListener.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Louis-me/selenium_java/HEAD/target/classes/util/ExtentTestNGIReporterListener.class
--------------------------------------------------------------------------------
/target/surefire-reports/old/wiseoper/main.html:
--------------------------------------------------------------------------------
1 | Results for wiseoper
2 | Select a result on the left-hand pane.
3 |
--------------------------------------------------------------------------------
/target/surefire-reports/old/TesterHome/main.html:
--------------------------------------------------------------------------------
1 | Results for TesterHome
2 | Select a result on the left-hand pane.
3 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM selenium/node-chrome
2 |
3 |
4 | USER root
5 |
6 | RUN apt-get update \
7 | && apt-get -y install ttf-wqy-microhei ttf-wqy-zenhei \
8 | && apt-get clean
--------------------------------------------------------------------------------
/src/main/java/browser/BrowserType.java:
--------------------------------------------------------------------------------
1 | package browser;
2 |
3 | public enum BrowserType
4 | {
5 | IE,
6 | Firefox,
7 | Chrome,
8 | Opera,
9 | Safari;
10 | }
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/target/surefire-reports/old/wiseoper/index.html:
--------------------------------------------------------------------------------
1 | Results for wiseoper
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/target/surefire-reports/old/TesterHome/index.html:
--------------------------------------------------------------------------------
1 | Results for TesterHome
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/target/classes/MyInfo.yaml:
--------------------------------------------------------------------------------
1 | testcase:
2 | - element_info: //a[contains(text(), "个人资料设置")]
3 | find_type: xpath
4 | operate_type: click
5 | check:
6 | - element_info: user_name
7 | operate_type: getValue
8 | find_type: id
9 | text: 测试小书童123
--------------------------------------------------------------------------------
/src/main/resources/MyInfo.yaml:
--------------------------------------------------------------------------------
1 | testcase:
2 | - element_info: //a[contains(text(), "个人资料设置")]
3 | find_type: xpath
4 | operate_type: click
5 | check:
6 | - element_info: user_name
7 | operate_type: getValue
8 | find_type: id
9 | text: 测试小书童123
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/main/java/browser/ComboBox.java:
--------------------------------------------------------------------------------
1 | package browser;
2 |
3 | import org.openqa.selenium.WebElement;
4 | import org.openqa.selenium.support.ui.Select;
5 |
6 | //组合框 控件是由一个文本输入控件和一个下拉菜单组成的
7 | public class ComboBox extends Select
8 | {
9 | public ComboBox(WebElement element)
10 | {
11 | super(element);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/target/surefire-reports/testng.css:
--------------------------------------------------------------------------------
1 | .invocation-failed, .test-failed { background-color: #DD0000; }
2 | .invocation-percent, .test-percent { background-color: #006600; }
3 | .invocation-passed, .test-passed { background-color: #00AA00; }
4 | .invocation-skipped, .test-skipped { background-color: #CCCC00; }
5 |
6 | .main-page {
7 | font-size: x-large;
8 | }
9 |
10 |
--------------------------------------------------------------------------------
/target/surefire-reports/wiseoper/登录.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/target/surefire-reports/TesterHome/登录.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/target/classes/Community.yaml:
--------------------------------------------------------------------------------
1 | testcase:
2 | - element_info: //*[@id="main-nav-menu"]/ul/li[1]
3 | find_type: xpath
4 | operate_type: click
5 | - element_info: /html/body/div[1]/nav/div/ul[1]/li/ul/li[3]
6 | find_type: xpath
7 | operate_type: click
8 | check:
9 | - element_info: //*[@id="main"]//a[contains(@title, "loadrunner 和 jmeter 大 PK")]
10 | find_type: xpath
11 |
--------------------------------------------------------------------------------
/src/main/resources/Community.yaml:
--------------------------------------------------------------------------------
1 | testcase:
2 | - element_info: //*[@id="main-nav-menu"]/ul/li[1]
3 | find_type: xpath
4 | operate_type: click
5 | - element_info: /html/body/div[1]/nav/div/ul[1]/li/ul/li[3]
6 | find_type: xpath
7 | operate_type: click
8 | check:
9 | - element_info: //*[@id="main"]//a[contains(@title, "loadrunner 和 jmeter 大 PK")]
10 | find_type: xpath
11 |
--------------------------------------------------------------------------------
/target/surefire-reports/junitreports/TEST-test.LoginTest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/target/surefire-reports/junitreports/TEST-test.LoginPageTest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/target/surefire-reports/junitreports/TEST-com.shark.selenium.LoginPageTest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/target/surefire-reports/junitreports/TEST-com.shark.selenium.MyinfoPageTest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/main/resources/LoginFail.yaml:
--------------------------------------------------------------------------------
1 | testcase:
2 | - element_info: account
3 | find_type: name
4 | operate_type: send_keys
5 | text: swx4583481
6 | - element_info: wiseopernice
7 | find_type: name
8 | operate_type: send_keys
9 | text: ~shikun1989
10 | - element_info: //*[@id="login"]/div[1]/div[2]/form/button[1]
11 | find_type: xpath
12 | operate_type: click
13 | check:
14 | - element_info: //*[@id="login1"]/div[1]/div[2]/form/div[4]/p[1]
15 | find_type: xpath
--------------------------------------------------------------------------------
/target/classes/LoginFail.yaml:
--------------------------------------------------------------------------------
1 | testcase:
2 | - element_info: account
3 | find_type: name
4 | operate_type: send_keys
5 | text: swx4583481
6 | - element_info: wiseopernice
7 | find_type: name
8 | operate_type: send_keys
9 | text: ~shikun1989
10 | - element_info: //*[@id="login"]/div[1]/div[2]/form/button[1]
11 | find_type: xpath
12 | operate_type: click
13 | check:
14 | - element_info: //*[@id="login1"]/div[1]/div[2]/form/div[4]/p[1]
15 | find_type: xpath
--------------------------------------------------------------------------------
/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst:
--------------------------------------------------------------------------------
1 | util\OperateElement.class
2 | util\TestMonitor.class
3 | model\TestCase.class
4 | model\CheckPoint.class
5 | pageobjects\MyInfoPage.class
6 | test\CommunityPageTest.class
7 | pageobjects\CommunityPage.class
8 | test\MyinfoPageTest.class
9 | util\ExtentTestNGIReporterListener.class
10 | util\PDFReportByGMail.class
11 | base\TestBaseSetup.class
12 | model\Report.class
13 | util\YamlRead.class
14 | test2.class
15 | pageobjects\LoginPage.class
16 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__junit_junit_4_12.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/target/classes/Login.yaml:
--------------------------------------------------------------------------------
1 | testcase:
2 | - element_info: account
3 | find_type: name
4 | operate_type: send_keys
5 | text: swx458348
6 | - element_info: wiseopernice
7 | find_type: name
8 | operate_type: send_keys
9 | text: ~shikun1989
10 | - element_info: //*[@id="login"]/div[1]/div[2]/form/button[1]
11 | find_type: xpath
12 | operate_type: click
13 | check:
14 | - element_info: //*[@id="dropdownMenuRole"]/span[2]/div[contains(text(),"shikun")]
15 | find_type: xpath
--------------------------------------------------------------------------------
/src/main/resources/Login.yaml:
--------------------------------------------------------------------------------
1 | testcase:
2 | - element_info: account
3 | find_type: name
4 | operate_type: send_keys
5 | text: swx458348
6 | - element_info: wiseopernice
7 | find_type: name
8 | operate_type: send_keys
9 | text: ~shikun1989
10 | - element_info: //*[@id="login"]/div[1]/div[2]/form/button[1]
11 | find_type: xpath
12 | operate_type: click
13 | check:
14 | - element_info: //*[@id="dropdownMenuRole"]/span[2]/div[contains(text(),"shikun")]
15 | find_type: xpath
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_jsoup_jsoup_1_9_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mongodb_bson_3_3_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_testng_testng_6_11.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/target/surefire-reports/2017-05-23T16-53-16_878-jvmRun1.dumpstream:
--------------------------------------------------------------------------------
1 | # Created on 2017-05-23T16:53:23.654
2 | TestSet has not finished before stream error has appeared >> initializing exit by non-null configuration: DEFAULT
3 | java.io.EOFException
4 | at java.io.DataInputStream.readInt(DataInputStream.java:392)
5 | at org.apache.maven.surefire.booter.MasterProcessCommand.decode(MasterProcessCommand.java:115)
6 | at org.apache.maven.surefire.booter.CommandReader$CommandRunnable.run(CommandReader.java:386)
7 | at java.lang.Thread.run(Thread.java:745)
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_w3c_css_sac_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_yaml_snakeyaml_1_17.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__xalan_xalan_2_7_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__log4j_log4j_1_2_17.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_beust_jcommander_1_64.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_java_dev_jna_jna_4_1_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__xalan_serializer_2_7_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__cglib_cglib_nodep_3_2_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_google_guava_guava_21_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_freemarker_freemarker_2_3_23.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__xml_apis_xml_apis_1_4_01.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__commons_io_commons_io_2_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__xerces_xercesImpl_2_11_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mongodb_mongodb_driver_3_3_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_aventstack_extentreports_3_0_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_google_code_gson_gson_2_8_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__commons_codec_commons_codec_1_10.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mongodb_mongodb_driver_core_3_3_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_esotericsoftware_yamlbeans_yamlbeans_1_11.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_commons_commons_exec_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_java_dev_jna_jna_platform_4_1_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_sourceforge_htmlunit_htmlunit_2_26.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_codeborne_phantomjsdriver_1_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__javax_servlet_javax_servlet_api_3_1_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_sourceforge_cssparser_cssparser_0_9_22.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_api_3_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_sourceforge_htmlunit_neko_htmlunit_2_25.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_java_3_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_seleniumhq_selenium_htmlunit_driver_2_26.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_eclipse_jetty_jetty_io_9_4_1_v20170120.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_sourceforge_htmlunit_htmlunit_core_js_2_26.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_support_3_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_eclipse_jetty_jetty_http_9_4_3_v20170317.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_eclipse_jetty_jetty_util_9_4_1_v20170120.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/main/java/util/YamlRead.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import com.esotericsoftware.yamlbeans.YamlException;
4 |
5 | import java.io.FileNotFoundException;
6 | import java.io.FileReader;
7 | import java.util.List;
8 | import java.util.Map;
9 |
10 | public class YamlRead {
11 |
12 | String path = "";
13 | public YamlRead(String path) {
14 | this.path = path;
15 | }
16 |
17 | public Map getYmal() throws YamlException, FileNotFoundException {
18 | String path = getClass().getResource(this.path).getPath();
19 | com.esotericsoftware.yamlbeans.YamlReader reader = new com.esotericsoftware.yamlbeans.YamlReader(new FileReader(path));
20 | Object object = reader.read();
21 | return (Map)object;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_eclipse_jetty_jetty_client_9_4_3_v20170317.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_ie_driver_3_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/target/surefire-reports/old/index.html:
--------------------------------------------------------------------------------
1 |
2 | Test results
3 |
4 |
5 | Test results
6 | Suite Passed Failed Skipped testng.xml
7 | Total 1 1 0
8 | wiseoper
9 | 1 1 0 Link
10 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_edge_driver_3_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_opera_driver_3_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_chrome_driver_3_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_remote_driver_3_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_safari_driver_3_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_firefox_driver_3_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_api_9_4_3_v20170317.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_client_9_4_3_v20170317.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_common_9_4_3_v20170317.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/target/test-classes/testng.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/target/surefire-reports/TesterHome/社区.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | ---
2 | chrome:
3 | image: chinese_chrome
4 | links:
5 | - hub
6 | ports:
7 | - "5902:5900"
8 | environment:
9 | - NODE_MAX_INSTANCES=30
10 | - NODE_MAX_SESSION=30
11 | - NODE_REGISTER_CYCLE=5000
12 | - DBUS_SESSION_BUS_ADDRESS=/dev/null
13 | volumes:
14 | - /dev/shm:/dev/shm
15 | firefox52:
16 | image: "baozhida/selenium-node-firefox:52"
17 | links:
18 | - hub
19 | ports:
20 | - "5903:5900"
21 | environment:
22 | - NODE_MAX_INSTANCES=30
23 | - NODE_MAX_SESSION=30
24 | - NODE_REGISTER_CYCLE=5000
25 | - DBUS_SESSION_BUS_ADDRESS=/dev/null
26 | volumes:
27 | - /dev/shm:/dev/shm
28 | firefox51:
29 | image: "baozhida/selenium-node-firefox:51"
30 | links:
31 | - hub
32 | ports:
33 | - "5901:5900"
34 | environment:
35 | - NODE_MAX_INSTANCES=30
36 | - NODE_MAX_SESSION=30
37 | - NODE_REGISTER_CYCLE=5000
38 | - DBUS_SESSION_BUS_ADDRESS=/dev/null
39 | volumes:
40 | - /dev/shm:/dev/shm
41 | hub:
42 | image: selenium/hub
43 | ports:
44 | - "4444:4444"
45 |
--------------------------------------------------------------------------------
/src/main/java/model/CheckPoint.java:
--------------------------------------------------------------------------------
1 | package model;
2 |
3 | /***
4 | * 检查点实体类
5 | */
6 | public class CheckPoint {
7 | private String element_info;//暂时没有用
8 | private String operate_type; //检查点方法,现在支持getValue,默认是查找,可自由拓展
9 | private String find_type;//暂时无用
10 | private String text; //文本框内容
11 | public String getElement_info() {
12 | return element_info;
13 | }
14 |
15 | public void setElement_info(String element_info) {
16 | this.element_info = element_info;
17 | }
18 |
19 | public void setOperate_type(String operate_type) {
20 | this.operate_type = operate_type;
21 | }
22 |
23 | public void setFind_type(String find_type) {
24 | this.find_type = find_type;
25 | }
26 |
27 | public void setText(String text) {
28 | this.text = text;
29 | }
30 |
31 | public String getOperate_type() {
32 | return operate_type;
33 | }
34 |
35 | public String getFind_type() {
36 | return find_type;
37 | }
38 |
39 | public String getText() {
40 | return text;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/target/surefire-reports/TesterHome/testng-failed.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/target/surefire-reports/testng-failed.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/target/classes/ApplyContinue1.yaml:
--------------------------------------------------------------------------------
1 | prefix:
2 | - element_info: //*[@id="setting"]/a
3 | find_type: xpath
4 | operate_type: click
5 | - element_info: //*[@id="J_left_div"]/div[1]/ul/li[14]/li/div/p
6 | find_type: xpath
7 | operate_type: click
8 | - element_info: //*[@id="personInformation"]/div[2]/div[1]/p[5]/a
9 | find_type: xpath
10 | operate_type: click
11 | frame: lfwiseopertest02.hwcloudtest.cn
12 | testcase:
13 | - element_info: applyReson
14 | find_type: name
15 | operate_type: send_keys
16 | text: 333333
17 | - element_info: (//*[@id="users"])[1]
18 | find_type: xpath
19 | operate_type: send_keys
20 | text: sunwei WX444350;
21 | defaultContent: 1
22 | - element_info: (//*[@id="users"])[2]
23 | find_type: xpath
24 | operate_type: send_keys
25 | text: sunwei WX444350;
26 | - element_info: //*[@id="wiseoper-content"]/div[3]/form/div/div[3]/button[1]
27 | find_type: xpath
28 | operate_type: click
29 | check:
30 | - element_info: //*[@id="wiseoper-content"]/div[3]/div/div[1]/span[3]
31 | find_type: xpath
32 |
--------------------------------------------------------------------------------
/src/main/resources/ApplyContinue1.yaml:
--------------------------------------------------------------------------------
1 | prefix:
2 | - element_info: //*[@id="setting"]/a
3 | find_type: xpath
4 | operate_type: click
5 | - element_info: //*[@id="J_left_div"]/div[1]/ul/li[14]/li/div/p
6 | find_type: xpath
7 | operate_type: click
8 | - element_info: //*[@id="personInformation"]/div[2]/div[1]/p[5]/a
9 | find_type: xpath
10 | operate_type: click
11 | frame: lfwiseopertest02.hwcloudtest.cn
12 | testcase:
13 | - element_info: applyReson
14 | find_type: name
15 | operate_type: send_keys
16 | text: 333333
17 | - element_info: (//*[@id="users"])[1]
18 | find_type: xpath
19 | operate_type: send_keys
20 | text: sunwei WX444350;
21 | defaultContent: 1
22 | - element_info: (//*[@id="users"])[2]
23 | find_type: xpath
24 | operate_type: send_keys
25 | text: sunwei WX444350;
26 | - element_info: //*[@id="wiseoper-content"]/div[3]/form/div/div[3]/button[1]
27 | find_type: xpath
28 | operate_type: click
29 | check:
30 | - element_info: //*[@id="wiseoper-content"]/div[3]/div/div[1]/span[3]
31 | find_type: xpath
32 |
--------------------------------------------------------------------------------
/target/surefire-reports/wiseoper/testng-failed.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst:
--------------------------------------------------------------------------------
1 | D:\selenium_java\src\main\java\model\CheckPoint.java
2 | D:\selenium_java\src\main\java\pageobjects\MyInfoPage.java
3 | D:\selenium_java\src\main\java\pageobjects\ApplyContinuePage.java
4 | D:\selenium_java\src\main\java\model\TestCase.java
5 | D:\selenium_java\src\main\java\util\OperateElement.java
6 | D:\selenium_java\src\main\java\test\ApplyContinueTest.java
7 | D:\selenium_java\src\main\java\test\CommunityPageTest.java
8 | D:\selenium_java\src\main\java\base\TestBaseSetup.java
9 | D:\selenium_java\src\main\java\pageobjects\CommunityPage.java
10 | D:\selenium_java\src\main\java\test\LoginTest.java
11 | D:\selenium_java\src\main\java\test2.java
12 | D:\selenium_java\src\main\java\util\PDFReportByGMail.java
13 | D:\selenium_java\src\main\java\util\WebBrower.java
14 | D:\selenium_java\src\main\java\util\ExtentTestNGIReporterListener.java
15 | D:\selenium_java\src\main\java\util\TestMonitor.java
16 | D:\selenium_java\src\main\java\test\MyinfoPageTest.java
17 | D:\selenium_java\src\main\java\model\Report.java
18 | D:\selenium_java\src\main\java\pageobjects\LoginPage.java
19 | D:\selenium_java\src\main\java\util\ExtentManager.java
20 | D:\selenium_java\src\main\java\util\YamlRead.java
21 |
--------------------------------------------------------------------------------
/target/surefire-reports/TestSuite.txt:
--------------------------------------------------------------------------------
1 | -------------------------------------------------------------------------------
2 | Test set: TestSuite
3 | -------------------------------------------------------------------------------
4 | Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 46.993 s <<< FAILURE! - in TestSuite
5 | testApplyContinue(test.ApplyContinueTest) Time elapsed: 28.575 s <<< FAILURE!
6 | org.openqa.selenium.TimeoutException: Expected condition failed: waiting for presence of element located by: By.xpath: //*[@id="wiseoper-content"]/div[3]/div/div[1]/span[3] (tried for 10 second(s) with 500 MILLISECONDS interval)
7 | at test.ApplyContinueTest.testApplyContinue(ApplyContinueTest.java:32)
8 | Caused by: org.openqa.selenium.NoSuchElementException:
9 | Cannot locate an element using By.xpath: //*[@id="wiseoper-content"]/div[3]/div/div[1]/span[3]
10 | For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
11 | Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
12 | System info: host: '4CV65290DX', ip: '192.168.1.180', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'
13 | Driver info: driver.version: unknown
14 | at test.ApplyContinueTest.testApplyContinue(ApplyContinueTest.java:32)
15 |
16 |
--------------------------------------------------------------------------------
/src/main/java/util/ExtentManager.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import com.aventstack.extentreports.ExtentReports;
4 | import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
5 | import com.aventstack.extentreports.reporter.configuration.ChartLocation;
6 | import com.aventstack.extentreports.reporter.configuration.Theme;
7 |
8 | /**
9 | * Created by sWX458348 on 2017/7/5.
10 | */
11 | public class ExtentManager {
12 | private static ExtentReports extent;
13 |
14 | public static ExtentReports getInstance(String s) {
15 | if (extent == null)
16 | createInstance("test-output/extent.html");
17 |
18 | return extent;
19 | }
20 |
21 | public static ExtentReports createInstance(String fileName) {
22 | ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(fileName);
23 | htmlReporter.config().setTestViewChartLocation(ChartLocation.BOTTOM);
24 | htmlReporter.config().setChartVisibilityOnOpen(true);
25 | htmlReporter.config().setTheme(Theme.STANDARD);
26 | htmlReporter.config().setDocumentTitle(fileName);
27 | htmlReporter.config().setEncoding("utf-8");
28 | htmlReporter.config().setReportName(fileName);
29 |
30 | extent = new ExtentReports();
31 | extent.attachReporter(htmlReporter);
32 |
33 | return extent;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/util/WebBrower.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import org.openqa.selenium.By;
4 | import org.openqa.selenium.JavascriptExecutor;
5 | import org.openqa.selenium.WebDriver;
6 | import org.openqa.selenium.WebElement;
7 |
8 | /**
9 | * Created by shikun on 2017/7/3.
10 | */
11 | public class WebBrower {
12 | private WebDriver driver;
13 | public WebBrower(WebDriver driver){
14 | this.driver = driver;
15 | }
16 |
17 | /**
18 | * 切换到iframe
19 | * frameName: iframe名字
20 | */
21 | public void switchToFrame(String frameName) {
22 | this.driver.switchTo().frame(frameName);
23 | }
24 |
25 | /**
26 | * 从iframe切换到默认页
27 | *
28 | */
29 | public void defaultContent() {
30 | this.driver.switchTo().defaultContent();
31 | }
32 |
33 | /**
34 | * 滚动条移动到指定元素位置
35 | *
36 | */
37 | public void executeScript(String elementInfo, WebElement webElement){
38 | System.out.println("executeScript==");
39 | // ((JavascriptExecutor) this.driver).executeScript("arguments[0].scrollIntoView();", webElement);
40 | ((JavascriptExecutor) this.driver).executeScript("arguments[0].style.height='auto';arguments[0].style.width='auto';", webElement);
41 | // ((JavascriptExecutor) this.driver).executeScript(elementInfo);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/test/CommunityPageTest.java:
--------------------------------------------------------------------------------
1 | package test;
2 |
3 | import browser.TestBaseSetup;
4 | import com.esotericsoftware.yamlbeans.YamlException;
5 | import org.junit.BeforeClass;
6 | import org.junit.Test;
7 | import org.openqa.selenium.WebDriver;
8 | import org.testng.Assert;
9 | import org.testng.annotations.Parameters;
10 | import pageobjects.CommunityPage;
11 | import pageobjects.LoginPage;
12 |
13 | import java.io.FileNotFoundException;
14 |
15 | //@Listeners(value= JyperionListener.class)
16 |
17 | public class CommunityPageTest {
18 | private WebDriver driver;
19 | private TestBaseSetup testBaseSetup = new TestBaseSetup();
20 | @Parameters({ "browserType", "appURL" ,"version", "remoteip"})
21 | @org.testng.annotations.BeforeClass
22 | public void setUp(String browserType, String appURL, String driverPath, String version, String remoteip) {
23 | driver = testBaseSetup.setDriver(browserType, appURL,version, remoteip);
24 | }
25 | @Test
26 | public void testHighQuality() throws YamlException, FileNotFoundException, InterruptedException {
27 | LoginPage loginPage = new LoginPage(this.driver, "/Login.yaml");
28 | loginPage.operate();
29 |
30 | CommunityPage communityPage = new CommunityPage(this.driver, "/Community.yaml");
31 | communityPage.operate();
32 | Assert.assertTrue(communityPage.checkpoint(), "检查点不通过");
33 | }
34 | }
35 |
36 |
--------------------------------------------------------------------------------
/src/main/java/test/MyinfoPageTest.java:
--------------------------------------------------------------------------------
1 | package test;
2 |
3 | import browser.TestBaseSetup;
4 | import com.esotericsoftware.yamlbeans.YamlException;
5 | import org.openqa.selenium.WebDriver;
6 | import org.testng.Assert;
7 | import org.testng.annotations.AfterClass;
8 | import org.testng.annotations.Parameters;
9 | import org.testng.annotations.Test;
10 | import pageobjects.LoginPage;
11 | import pageobjects.MyInfoPage;
12 |
13 | import java.io.FileNotFoundException;
14 |
15 | //@Listeners(value= JyperionListener.class)
16 |
17 | public class MyinfoPageTest {
18 | private WebDriver driver;
19 | private TestBaseSetup testBaseSetup = new TestBaseSetup();
20 | @Parameters({ "browserType", "appURL" ,"driverPath","version", "remoteip"})
21 | @org.testng.annotations.BeforeClass
22 | public void setUp(String browserType, String appURL, String driverPath, String version, String remoteip) {
23 | driver = testBaseSetup.setDriver(browserType, appURL,version, remoteip);
24 | }
25 | @Test
26 | public void testMyInfo() throws YamlException, FileNotFoundException, InterruptedException {
27 | LoginPage loginPage = new LoginPage(this.driver, "/Login.yaml");
28 | loginPage.operate();
29 |
30 | MyInfoPage myInfoPage = new MyInfoPage(this.driver, "/Myinfo.yaml");
31 | myInfoPage.operate();
32 | Assert.assertTrue(myInfoPage.checkpoint(), "检查点不通过");
33 | }
34 | @AfterClass
35 | public synchronized void tearDown() {
36 | driver.quit();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/logs/error.log:
--------------------------------------------------------------------------------
1 | 2017-07-24 09:34:43 [ TestNG-tests-1:41600 ] - [ ERROR ]2017-07-24 09:34:43 [ TestNG-tests-1:41601 ] - [ ERROR ]2017-07-24 09:54:04 [ TestNG-tests-1:29355 ] - [ ERROR ]2017-07-24 09:54:04 [ TestNG-tests-1:29356 ] - [ ERROR ]2017-07-24 09:54:05 [ TestNG-tests-2:30065 ] - [ ERROR ]2017-07-24 09:54:05 [ TestNG-tests-2:30066 ] - [ ERROR ]2017-07-24 10:06:38 [ TestNG-tests-1:32694 ] - [ ERROR ]2017-07-24 10:06:38 [ TestNG-tests-1:32695 ] - [ ERROR ]2017-07-24 10:31:13 [ TestNG-tests-2:35431 ] - [ ERROR ]2017-07-24 10:31:13 [ TestNG-tests-2:35433 ] - [ ERROR ]2017-07-24 11:04:05 [ TestNG-tests-2:18197 ] - [ ERROR ]2017-07-24 11:04:05 [ TestNG-tests-2:18198 ] - [ ERROR ]2017-07-24 11:05:57 [ TestNG-tests-3:18160 ] - [ ERROR ]2017-07-24 11:05:57 [ TestNG-tests-3:18160 ] - [ ERROR ]2017-07-24 11:07:07 [ TestNG-tests-3:21045 ] - [ ERROR ]2017-07-24 11:07:07 [ TestNG-tests-3:21045 ] - [ ERROR ]2017-07-24 11:09:37 [ TestNG-tests-3:18309 ] - [ ERROR ]2017-07-24 11:09:37 [ TestNG-tests-3:18309 ] - [ ERROR ]2017-07-24 11:22:42 [ TestNG-tests-3:19368 ] - [ ERROR ]2017-07-24 11:22:42 [ TestNG-tests-3:19369 ] - [ ERROR ]2017-07-24 11:26:30 [ TestNG-tests-3:15320 ] - [ ERROR ]2017-07-24 11:26:30 [ TestNG-tests-3:15320 ] - [ ERROR ]2017-07-24 17:14:23 [ TestNG-tests-4:16311 ] - [ ERROR ]2017-07-24 17:14:23 [ TestNG-tests-4:16311 ] - [ ERROR ]2017-07-24 17:16:00 [ TestNG-tests-4:10491 ] - [ ERROR ]2017-07-24 17:16:00 [ TestNG-tests-4:10493 ] - [ ERROR ]2017-07-24 17:16:00 [ TestNG-tests-1:10517 ] - [ ERROR ]2017-07-24 17:16:00 [ TestNG-tests-1:10518 ] - [ ERROR ]
--------------------------------------------------------------------------------
/target/surefire-reports/old/wiseoper/toc.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Results for wiseoper
4 |
5 |
6 |
7 |
8 | Results forwiseoper
9 |
23 |
30 |
31 |
38 |
--------------------------------------------------------------------------------
/target/surefire-reports/old/TesterHome/toc.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Results for TesterHome
4 |
5 |
6 |
7 |
8 | Results forTesterHome
9 |
23 |
30 |
31 |
38 |
--------------------------------------------------------------------------------
/target/surefire-reports/old/TesterHome/testng.xml.html:
--------------------------------------------------------------------------------
1 | testng.xml for TesterHome <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="2" guice-stage="DEVELOPMENT" verbose="0" name="TesterHome" parallel="tests">
<parameter name="driverPath" value="C:\Program Files (x86)\Google\Chrome\Application\"/>
<parameter name="appURL" value="https://testerhome.com/account/sign_in"/>
<parameter name="browserType" value="chrome"/>
<listeners>
<listener class-name="util.ExtentTestNGIReporterListener"/>
<listener class-name="util.TestMonitor"/>
</listeners>
<test name="登录">
<classes>
<class name="test.LoginPageTest"/>
</classes>
</test> <!-- 登录 -->
<test name="社区">
<classes>
<class name="test.MyinfoPageTest"/>
</classes>
</test> <!-- 社区 -->
</suite> <!-- TesterHome -->
--------------------------------------------------------------------------------
/target/surefire-reports/old/wiseoper/testng.xml.html:
--------------------------------------------------------------------------------
1 | testng.xml for wiseoper <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="1" guice-stage="DEVELOPMENT" verbose="0" name="wiseoper" parallel="tests">
<parameter name="driverPath" value="C:\Program Files (x86)\Google\Chrome\Application\"/>
<parameter name="appURL" value="https://lfwiseopertest02.hwcloudtest.cn:8443/#/login"/>
<parameter name="browserType" value="chrome"/>
<listeners>
<listener class-name="util.ExtentTestNGIReporterListener"/>
<listener class-name="util.TestMonitor"/>
</listeners>
<test name="登录">
<classes>
<class name="test.LoginTest"/>
</classes>
</test> <!-- 登录 -->
<test name="账号延期">
<classes>
<class name="test.ApplyContinueTest"/>
</classes>
</test> <!-- 账号延期 -->
</suite> <!-- wiseoper -->
--------------------------------------------------------------------------------
/src/main/java/model/TestCase.java:
--------------------------------------------------------------------------------
1 | package model;
2 |
3 | public class TestCase {
4 | private String element_info; ////*[@id="new_user"]/div[4]/input
5 | private String find_type;// id,xpath,name,classname
6 | private String operate_type; // click,send_keys...
7 | private String text; //文本框内容,或者其他内容
8 | private String frame; // frame的值
9 | private String defaultContent; //切换到默认主页面
10 | public void setElement_info(String element_info) {
11 | this.element_info = element_info;
12 | }
13 |
14 | public void setFind_type(String find_type) {
15 | this.find_type = find_type;
16 | }
17 |
18 | public void setOperate_type(String operate_type) {
19 | this.operate_type = operate_type;
20 | }
21 |
22 | public void setText(String text) {
23 | this.text = text;
24 | }
25 |
26 | public String getElement_info() {
27 |
28 | return element_info;
29 | }
30 |
31 | public String getFind_type() {
32 | return find_type;
33 | }
34 |
35 | public String getOperate_type() {
36 | return operate_type;
37 | }
38 |
39 | public String getText() {
40 | return text;
41 | }
42 |
43 | public String getFrame() {
44 | return frame;
45 | }
46 |
47 | public void setFrame(String frame) {
48 | this.frame = frame;
49 | }
50 |
51 | public String getDefaultContent() {
52 | return defaultContent;
53 | }
54 |
55 | public void setDefaultContent(String defaultContent) {
56 | this.defaultContent = defaultContent;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/test/ApplyContinueTest.java:
--------------------------------------------------------------------------------
1 | package test;
2 |
3 | import browser.TestBaseSetup;
4 | import com.esotericsoftware.yamlbeans.YamlException;
5 | import org.openqa.selenium.WebDriver;
6 | import org.testng.Assert;
7 | import org.testng.annotations.*;
8 | import pageobjects.ApplyContinuePage;
9 | import pageobjects.LoginPage;
10 | import util.ExtentTestNGIReporterListener;
11 |
12 | import java.io.FileNotFoundException;
13 |
14 | /**
15 | * Created by shikun on 2017/7/4.
16 | */
17 |
18 |
19 |
20 | public class ApplyContinueTest {
21 | private WebDriver driver;
22 | private TestBaseSetup testBaseSetup = new TestBaseSetup();
23 | private String browserType;
24 |
25 |
26 | @Parameters({ "browserType", "appURL" ,"browserVersion", "remoteIP"})
27 | @BeforeClass
28 | public void setUp(String browserType, String appURL, String browserVersion, String remoteIP) {
29 | driver = testBaseSetup.setDriver(browserType, appURL,browserVersion, remoteIP);
30 | this.browserType = browserType;
31 | }
32 |
33 |
34 | @Test
35 | public void testApplyContinue() throws YamlException, FileNotFoundException, InterruptedException {
36 | LoginPage loginPage = new LoginPage(this.driver, "/Login.yaml");
37 | loginPage.operate();
38 |
39 | ApplyContinuePage applyContinuePage = new ApplyContinuePage(this.driver, "/ApplyContinue1.yaml");
40 | applyContinuePage.operate();
41 | Assert.assertTrue(applyContinuePage.checkpoint(this.browserType), "检查点不通过");
42 |
43 | }
44 | @AfterClass
45 | public void tearDown() {
46 | this.driver.quit();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/logs/error.log.2017-07-21:
--------------------------------------------------------------------------------
1 | 2017-07-21 09:16:38 [ TestNG-tests-1:48762 ] - [ ERROR ]2017-07-21 09:16:38 [ TestNG-tests-1:48781 ] - [ ERROR ]2017-07-21 09:16:42 [ TestNG-tests-2:52446 ] - [ ERROR ]2017-07-21 09:16:42 [ TestNG-tests-2:52446 ] - [ ERROR ]2017-07-21 09:23:07 [ TestNG-tests-1:36689 ] - [ ERROR ]2017-07-21 09:23:07 [ TestNG-tests-1:36690 ] - [ ERROR ]2017-07-21 09:23:08 [ TestNG-tests-2:38085 ] - [ ERROR ]2017-07-21 09:23:08 [ TestNG-tests-2:38085 ] - [ ERROR ]2017-07-21 09:41:08 [ TestNG-tests-1:29460 ] - [ ERROR ]2017-07-21 09:41:08 [ TestNG-tests-1:29461 ] - [ ERROR ]2017-07-21 09:41:11 [ TestNG-tests-2:32620 ] - [ ERROR ]2017-07-21 09:41:11 [ TestNG-tests-2:32620 ] - [ ERROR ]2017-07-21 09:48:22 [ TestNG-tests-1:25483 ] - [ ERROR ]2017-07-21 09:48:22 [ TestNG-tests-1:25484 ] - [ ERROR ]2017-07-21 09:48:25 [ TestNG-tests-2:28509 ] - [ ERROR ]2017-07-21 09:48:25 [ TestNG-tests-2:28509 ] - [ ERROR ]2017-07-21 09:52:16 [ TestNG-tests-1:26672 ] - [ ERROR ]2017-07-21 09:52:16 [ TestNG-tests-1:26673 ] - [ ERROR ]2017-07-21 09:52:19 [ TestNG-tests-2:29201 ] - [ ERROR ]2017-07-21 09:52:19 [ TestNG-tests-2:29201 ] - [ ERROR ]2017-07-21 09:52:30 [ TestNG-tests-1:40466 ] - [ ERROR ]2017-07-21 09:52:30 [ TestNG-tests-1:40466 ] - [ ERROR ]2017-07-21 09:52:33 [ TestNG-tests-2:43353 ] - [ ERROR ]2017-07-21 09:52:33 [ TestNG-tests-2:43353 ] - [ ERROR ]2017-07-21 09:52:54 [ TestNG-tests-1:64334 ] - [ ERROR ]2017-07-21 09:52:54 [ TestNG-tests-1:64334 ] - [ ERROR ]2017-07-21 09:55:02 [ TestNG-tests-1:45364 ] - [ ERROR ]2017-07-21 09:55:02 [ TestNG-tests-1:45365 ] - [ ERROR ]2017-07-21 10:07:27 [ TestNG-tests-2:45480 ] - [ ERROR ]2017-07-21 10:07:27 [ TestNG-tests-2:45481 ] - [ ERROR ]
--------------------------------------------------------------------------------
/target/surefire-reports/old/TesterHome/classes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Class name
4 | Method name
5 | Groups
6 |
7 | test.LoginPageTest
8 |
9 |
10 | @Test
11 |
12 |
13 |
14 | testLogin
15 |
16 |
17 | @BeforeClass
18 |
19 |
20 |
21 | initializeTestBaseSetup
22 |
23 |
24 |
25 | setUp
26 |
27 |
28 | @BeforeMethod
29 |
30 |
31 | @AfterMethod
32 |
33 |
34 | @AfterClass
35 |
36 |
37 |
38 | tearDown
39 |
40 |
41 | test.MyinfoPageTest
42 |
43 |
44 | @Test
45 |
46 |
47 |
48 | testMyInfo
49 |
50 |
51 | @BeforeClass
52 |
53 |
54 |
55 | initializeTestBaseSetup
56 |
57 |
58 |
59 | setUp
60 |
61 |
62 | @BeforeMethod
63 |
64 |
65 | @AfterMethod
66 |
67 |
68 | @AfterClass
69 |
70 |
71 |
72 | tearDown
73 |
74 |
75 |
--------------------------------------------------------------------------------
/target/surefire-reports/old/wiseoper/classes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Class name
4 | Method name
5 | Groups
6 |
7 | test.ApplyContinueTest
8 |
9 |
10 | @Test
11 |
12 |
13 |
14 | testApplyContinue
15 |
16 |
17 | @BeforeClass
18 |
19 |
20 |
21 | initializeTestBaseSetup
22 |
23 |
24 |
25 | setUp
26 |
27 |
28 | @BeforeMethod
29 |
30 |
31 | @AfterMethod
32 |
33 |
34 | @AfterClass
35 |
36 |
37 |
38 | tearDown
39 |
40 |
41 | test.LoginTest
42 |
43 |
44 | @Test
45 |
46 |
47 |
48 | testLogin
49 |
50 |
51 | @BeforeClass
52 |
53 |
54 |
55 | initializeTestBaseSetup
56 |
57 |
58 |
59 | setUp
60 |
61 |
62 | @BeforeMethod
63 |
64 |
65 | @AfterMethod
66 |
67 |
68 | @AfterClass
69 |
70 |
71 |
72 | tearDown
73 |
74 |
75 |
--------------------------------------------------------------------------------
/src/main/java/test/LoginTest.java:
--------------------------------------------------------------------------------
1 | package test;
2 |
3 | import browser.TestBaseSetup;
4 | import com.esotericsoftware.yamlbeans.YamlException;
5 | import org.openqa.selenium.WebDriver;
6 | import org.testng.Assert;
7 | import org.testng.ITestContext;
8 | import org.testng.annotations.*;
9 | import pageobjects.LoginPage;
10 |
11 | import java.io.FileNotFoundException;
12 |
13 | public class LoginTest {
14 | private WebDriver driver;
15 | private TestBaseSetup testBaseSetup = new TestBaseSetup();
16 | private String browserType = "";
17 |
18 |
19 | @Parameters({ "browserType", "appURL" ,"browserVersion", "remoteIP"})
20 | @BeforeClass
21 | public void setUp(String browserType, String appURL, String browserVersion, String remoteIP, ITestContext testContext) {
22 | driver = testBaseSetup.setDriver(browserType, appURL,browserVersion, remoteIP);
23 | this.browserType = browserType;
24 | }
25 |
26 |
27 | // @Test(priority = 0)
28 | // public void testLoginFail() throws YamlException, FileNotFoundException, InterruptedException {
29 | // LoginPage loginPage = new LoginPage(this.driver, "/LoginFail.yaml");
30 | // loginPage.operate();
31 | // Assert.assertTrue(loginPage.checkpoint(this.browserType), "检查点不通过");
32 | //
33 | // }
34 | @Test(priority = 1)
35 | public void testLogin() throws YamlException, FileNotFoundException, InterruptedException {
36 | LoginPage loginPage = new LoginPage(this.driver, "/Login.yaml");
37 | loginPage.operate();
38 | Assert.assertTrue(loginPage.checkpoint(this.browserType), "检查点不通过");
39 |
40 | }
41 |
42 | @AfterClass
43 | public void tearDown() {
44 |
45 | this.driver.quit();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/util/TestMonitor.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import java.io.PrintWriter;
4 | import java.io.StringWriter;
5 |
6 | import org.apache.log4j.Logger;
7 | import org.apache.log4j.PropertyConfigurator;
8 | import org.testng.ITestContext;
9 | import org.testng.ITestResult;
10 |
11 | public class TestMonitor implements org.testng.ITestListener {
12 |
13 | public Logger log = Logger.getLogger(this.getClass().getName());
14 |
15 | @Override
16 | public void onFinish(ITestContext arg0) {
17 | log.info("Test " + arg0.getName() + " Ends");
18 | log.info("---------------------------------------------------------");
19 | }
20 |
21 | @Override
22 | public void onStart(ITestContext arg0) {
23 | PropertyConfigurator.configure("res/log4j.properties");
24 | log.info("Test " + arg0.getName() + " Starts");
25 | }
26 |
27 | @Override
28 | public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
29 | log.info("Test failed within success Percentage");
30 | }
31 |
32 | @Override
33 | public void onTestFailure(ITestResult arg0) {
34 | log.info("Test run has failed");
35 | log.error(arg0.getThrowable().getMessage());
36 |
37 | StringWriter sw = new StringWriter();
38 | arg0.getThrowable().printStackTrace(new PrintWriter(sw));
39 | String stacktrace = sw.toString();
40 | log.error(stacktrace.trim());
41 | }
42 |
43 | @Override
44 | public void onTestSkipped(ITestResult arg0) {
45 | log.info("Test skipped");
46 | }
47 |
48 | @Override
49 | public void onTestStart(ITestResult arg0) {
50 | log.info("Test Method " + arg0.getMethod().getMethodName()
51 | + " executing...");
52 | }
53 |
54 | @Override
55 | public void onTestSuccess(ITestResult arg0) {
56 | log.info("Test run is successful");
57 | }
58 |
59 | }
--------------------------------------------------------------------------------
/res/testng.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/target/surefire-reports/junitreports/TEST-test.MyinfoPageTest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/target/surefire-reports/wiseoper/登录.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | TestNG: 登录
4 |
5 |
6 |
7 |
11 |
53 |
54 |
55 |
56 | 登录
57 |
58 | Tests passed/Failed/Skipped: 1/0/0
59 |
60 | Started on: Wed Jul 05 17:47:29 CST 2017
61 |
62 | Total time: 13 seconds (13051 ms)
63 |
64 | Included groups:
65 |
66 | Excluded groups:
67 |
68 |
69 | (Hover the method name to see the test class name)
70 |
71 | PASSED TESTS
72 | Test method
73 | Exception
74 | Time (seconds)
75 | Instance
76 |
77 |
78 | testLogin Test class: test.LoginTest
79 |
80 | 7
81 | test.LoginTest@1d8d30f7
82 |
83 |
84 |
--------------------------------------------------------------------------------
/target/surefire-reports/TesterHome/登录.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | TestNG: 登录
4 |
5 |
6 |
7 |
11 |
53 |
54 |
55 |
56 | 登录
57 |
58 | Tests passed/Failed/Skipped: 1/0/0
59 |
60 | Started on: Tue May 23 17:06:05 CST 2017
61 |
62 | Total time: 17 seconds (17267 ms)
63 |
64 | Included groups:
65 |
66 | Excluded groups:
67 |
68 |
69 | (Hover the method name to see the test class name)
70 |
71 | PASSED TESTS
72 | Test method
73 | Exception
74 | Time (seconds)
75 | Instance
76 |
77 |
78 | testLogin Test class: test.LoginPageTest
79 |
80 | 4
81 | test.LoginPageTest@48eff760
82 |
83 |
84 |
--------------------------------------------------------------------------------
/src/main/java/pageobjects/MyInfoPage.java:
--------------------------------------------------------------------------------
1 | package pageobjects;
2 |
3 | import com.esotericsoftware.yamlbeans.YamlException;
4 | import model.CheckPoint;
5 | import model.TestCase;
6 | import org.openqa.selenium.WebDriver;
7 | import util.OperateElement;
8 | import util.YamlRead;
9 |
10 | import java.io.FileNotFoundException;
11 | import java.util.List;
12 | import java.util.Map;
13 |
14 |
15 | public class MyInfoPage {
16 | YamlRead yamlRead;
17 | OperateElement operateElement;
18 | protected WebDriver driver;
19 | private boolean isOperate = true;
20 |
21 |
22 | public MyInfoPage(WebDriver driver){
23 | this.driver = driver;
24 | }
25 |
26 | public MyInfoPage(WebDriver driver, String path){
27 | this.driver = driver;
28 | yamlRead = new YamlRead(path);
29 | operateElement= new OperateElement(this.driver);
30 | }
31 | /***
32 | * 测试步骤
33 | * @throws YamlException
34 | * @throws FileNotFoundException
35 | */
36 | public void operate() throws YamlException, FileNotFoundException, InterruptedException {
37 | List list = (List) yamlRead.getYmal().get("testcase");
38 | for(Object item: list){
39 | TestCase testCase = new TestCase();
40 | testCase.setFind_type((String) ((Map)item).get("find_type"));
41 | testCase.setElement_info((String) ((Map)item).get("element_info"));
42 | // testCase.setText((String) ((Map)item).get("text"));
43 | testCase.setOperate_type((String) ((Map)item).get("operate_type"));
44 | if (!operateElement.operate(testCase)) {
45 | isOperate = false;
46 | System.out.println("操作失败");
47 | break;
48 | }
49 | }
50 | }
51 |
52 | /***
53 | * 检查点
54 | * @return
55 | * @throws YamlException
56 | * @throws FileNotFoundException
57 | */
58 | public boolean checkpoint() throws YamlException, FileNotFoundException, InterruptedException {
59 | if (!isOperate) { // 如果操作步骤失败,检查点也就判断失败
60 | System.out.println("操作步骤失败了");
61 | return false;
62 | }
63 | List list = (List) yamlRead.getYmal().get("check");
64 | // System.out.println(list);
65 | for(Object item: list){
66 | CheckPoint checkPoint = new CheckPoint();
67 | checkPoint.setElement_info((String) ((Map)item).get("element_info"));
68 | checkPoint.setFind_type((String) ((Map)item).get("find_type"));
69 | checkPoint.setOperate_type((String) ((Map)item).get("operate_type"));
70 | checkPoint.setText((String) ((Map)item).get("text"));
71 | if (!operateElement.checkElement(checkPoint)) {
72 | return false;
73 | }
74 | }
75 | return true;
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/target/surefire-reports/wiseoper/账号延期.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/main/java/pageobjects/CommunityPage.java:
--------------------------------------------------------------------------------
1 | package pageobjects;
2 |
3 | import com.esotericsoftware.yamlbeans.YamlException;
4 | import model.CheckPoint;
5 | import model.TestCase;
6 | import org.openqa.selenium.WebDriver;
7 | import util.OperateElement;
8 | import util.YamlRead;
9 |
10 | import java.io.FileNotFoundException;
11 | import java.util.List;
12 | import java.util.Map;
13 |
14 | public class CommunityPage {
15 | YamlRead yamlRead;
16 | OperateElement operateElement;
17 | protected WebDriver driver;
18 | private boolean isOperate = true;
19 |
20 | /***
21 | * 默认构造函数
22 | * @param driver
23 | * @param path yaml配置参数
24 | */
25 | public CommunityPage(WebDriver driver, String path) {
26 | this.driver = driver;
27 | yamlRead = new YamlRead(path);
28 | operateElement= new OperateElement(this.driver);
29 | }
30 |
31 | /***
32 | * 测试步骤
33 | * @throws YamlException
34 | * @throws FileNotFoundException
35 | */
36 | public void operate() throws YamlException, FileNotFoundException, InterruptedException {
37 | List list = (List) yamlRead.getYmal().get("testcase");
38 | for(Object item: list){
39 | TestCase testCase = new TestCase();
40 | testCase.setFind_type((String) ((Map)item).get("find_type"));
41 | testCase.setElement_info((String) ((Map)item).get("element_info"));
42 | // testCase.setText((String) ((Map)item).get("text"));
43 | testCase.setOperate_type((String) ((Map)item).get("operate_type"));
44 | if (!operateElement.operate(testCase)) {
45 | isOperate = false;
46 | System.out.println("操作失败");
47 | break;
48 | }
49 | }
50 | }
51 |
52 | /***
53 | * 检查点
54 | * @return
55 | * @throws YamlException
56 | * @throws FileNotFoundException
57 | */
58 | public boolean checkpoint() throws YamlException, FileNotFoundException, InterruptedException {
59 | if (!isOperate) { // 如果操作步骤失败,检查点也就判断失败
60 | System.out.println("操作步骤失败了");
61 | return false;
62 | }
63 | List list = (List) yamlRead.getYmal().get("check");
64 | for(Object item: list){
65 | CheckPoint checkPoint = new CheckPoint();
66 | checkPoint.setElement_info((String) ((Map)item).get("element_info"));
67 | checkPoint.setFind_type((String) ((Map)item).get("find_type"));
68 | if (!operateElement.checkElement(checkPoint)) {
69 | return false;
70 | }
71 | }
72 | return true;
73 | }
74 |
75 | /***
76 | * 个人信息页面
77 | * @return
78 | */
79 | // public MyInfoPage myInfoPage() {
80 | // System.out.println("进入到个人信息页面");
81 | // return new MyInfoPage(this.driver,"/Myinfo.yaml");
82 | // }
83 | }
84 |
--------------------------------------------------------------------------------
/target/surefire-reports/old/TesterHome/methods.html:
--------------------------------------------------------------------------------
1 |
Methods run, sorted chronologically >> means before, << means after
TesterHome
(Hover the method name to see the test class name)
2 |
3 | Time Delta (ms) Suite configuration Test configuration Class configuration Groups configuration Method configuration Test method Thread Instances
4 | 17/05/23 17:06:05 0 >>initializeTestBaseSetup
5 | TestNG-tests-2@285411846
6 | 17/05/23 17:06:05 0 >>initializeTestBaseSetup
7 | TestNG-tests-1@476596909
8 | 17/05/23 17:06:15 9899 >>setUp
9 | TestNG-tests-1@476596909
10 | 17/05/23 17:06:15 9912 testLogin
11 | TestNG-tests-1@476596909
12 | 17/05/23 17:06:15 10043 >>setUp
13 | TestNG-tests-2@285411846
14 | 17/05/23 17:06:15 10045 testMyInfo
15 | TestNG-tests-2@285411846
16 | 17/05/23 17:06:20 14834 <<tearDown
17 | TestNG-tests-1@476596909
18 | 17/05/23 17:06:22 16878 <<tearDown
19 | TestNG-tests-2@285411846
20 |
21 |
--------------------------------------------------------------------------------
/target/surefire-reports/old/TesterHome/methods-alphabetical.html:
--------------------------------------------------------------------------------
1 | Methods run, sorted chronologically >> means before, << means after
TesterHome
(Hover the method name to see the test class name)
2 |
3 | Time Delta (ms) Suite configuration Test configuration Class configuration Groups configuration Method configuration Test method Thread Instances
4 | 17/05/23 17:06:05 0 >>initializeTestBaseSetup
5 | TestNG-tests-2@285411846
6 | 17/05/23 17:06:05 0 >>initializeTestBaseSetup
7 | TestNG-tests-1@476596909
8 | 17/05/23 17:06:15 9899 >>setUp
9 | TestNG-tests-1@476596909
10 | 17/05/23 17:06:15 10043 >>setUp
11 | TestNG-tests-2@285411846
12 | 17/05/23 17:06:20 14834 <<tearDown
13 | TestNG-tests-1@476596909
14 | 17/05/23 17:06:22 16878 <<tearDown
15 | TestNG-tests-2@285411846
16 | 17/05/23 17:06:15 9912 testLogin
17 | TestNG-tests-1@476596909
18 | 17/05/23 17:06:15 10045 testMyInfo
19 | TestNG-tests-2@285411846
20 |
21 |
--------------------------------------------------------------------------------
/target/surefire-reports/old/wiseoper/methods.html:
--------------------------------------------------------------------------------
1 | Methods run, sorted chronologically >> means before, << means after
wiseoper
(Hover the method name to see the test class name)
2 |
3 | Time Delta (ms) Suite configuration Test configuration Class configuration Groups configuration Method configuration Test method Thread Instances
4 | 17/07/05 17:47:30 0 >>initializeTestBaseSetup
5 | TestNG-tests-1@1923515463
6 | 17/07/05 17:47:34 4270 >>setUp
7 | TestNG-tests-1@1923515463
8 | 17/07/05 17:47:34 4281 testLogin
9 | TestNG-tests-1@1923515463
10 | 17/07/05 17:47:42 12203 <<tearDown
11 | TestNG-tests-1@1923515463
12 | 17/07/05 17:47:43 13253 >>initializeTestBaseSetup
13 | TestNG-tests-1@1923515463
14 | 17/07/05 17:47:47 17192 >>setUp
15 | TestNG-tests-1@1923515463
16 | 17/07/05 17:47:47 17193 testApplyContinue
17 | TestNG-tests-1@1923515463
18 | 17/07/05 17:48:15 45482 <<tearDown
19 | TestNG-tests-1@1923515463
20 |
21 |
--------------------------------------------------------------------------------
/target/surefire-reports/old/wiseoper/methods-alphabetical.html:
--------------------------------------------------------------------------------
1 | Methods run, sorted chronologically >> means before, << means after
wiseoper
(Hover the method name to see the test class name)
2 |
3 | Time Delta (ms) Suite configuration Test configuration Class configuration Groups configuration Method configuration Test method Thread Instances
4 | 17/07/05 17:47:30 0 >>initializeTestBaseSetup
5 | TestNG-tests-1@1923515463
6 | 17/07/05 17:47:43 13253 >>initializeTestBaseSetup
7 | TestNG-tests-1@1923515463
8 | 17/07/05 17:47:34 4270 >>setUp
9 | TestNG-tests-1@1923515463
10 | 17/07/05 17:47:47 17192 >>setUp
11 | TestNG-tests-1@1923515463
12 | 17/07/05 17:47:42 12203 <<tearDown
13 | TestNG-tests-1@1923515463
14 | 17/07/05 17:48:15 45482 <<tearDown
15 | TestNG-tests-1@1923515463
16 | 17/07/05 17:47:47 17193 testApplyContinue
17 | TestNG-tests-1@1923515463
18 | 17/07/05 17:47:34 4281 testLogin
19 | TestNG-tests-1@1923515463
20 |
21 |
--------------------------------------------------------------------------------
/src/main/java/util/ExtentTestNGIReporterListener.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import com.aventstack.extentreports.ExtentReports;
4 | import com.aventstack.extentreports.ExtentTest;
5 | import com.aventstack.extentreports.MediaEntityBuilder;
6 | import com.aventstack.extentreports.Status;
7 | import com.aventstack.extentreports.model.TestAttribute;
8 | import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
9 | import com.aventstack.extentreports.reporter.configuration.ChartLocation;
10 | import com.aventstack.extentreports.reporter.configuration.Theme;
11 | import org.apache.commons.io.FileUtils;
12 | import org.openqa.selenium.OutputType;
13 | import org.openqa.selenium.TakesScreenshot;
14 | import org.openqa.selenium.WebDriver;
15 | import org.testng.*;
16 | import org.testng.xml.XmlSuite;
17 |
18 | import java.io.File;
19 | import java.io.IOException;
20 | import java.util.*;
21 |
22 | public class ExtentTestNGIReporterListener implements ITestListener {
23 |
24 | private static ExtentReports extent = ExtentManager.getInstance("test-output/extent.html");
25 | private static ThreadLocal test = new ThreadLocal();
26 | // public static WebDriver driver;
27 | public static String fileName;
28 | @Override
29 | public synchronized void onStart(ITestContext context) {
30 | }
31 |
32 | @Override
33 | public synchronized void onFinish(ITestContext context) {
34 | extent.flush();
35 | }
36 |
37 | @Override
38 | public synchronized void onTestStart(ITestResult result) {
39 | test.set(extent.createTest(result.getMethod().getMethodName()));
40 | }
41 |
42 | @Override
43 | public synchronized void onTestSuccess(ITestResult result) {
44 | ((ExtentTest)test.get()).pass("Test passed");
45 | }
46 |
47 | @Override
48 | public synchronized void onTestFailure(ITestResult result) {
49 | ((ExtentTest)test.get()).fail(result.getThrowable());
50 | File directory = new File("test-output");
51 | try {
52 | String screenPath = directory.getCanonicalPath() + "\\";
53 | File file = new File(screenPath);
54 | if (!file.exists()){
55 | file.mkdirs();
56 | }
57 | System.out.println("------------onTestFailure--------");
58 |
59 | // fileName = screenPath + result.getMethod().getMethodName() + UUID.randomUUID().toString() + ".png";
60 | // driver.switchTo().defaultContent();
61 | // File srcFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
62 | // FileUtils.copyFile(srcFile, new File(fileName));
63 | ((ExtentTest)test.get()).addScreenCaptureFromPath(fileName);
64 | } catch (Exception e) {
65 | e.printStackTrace();
66 | System.out.println("------------Exception--------");
67 | System.out.println(e.getMessage());
68 | }
69 |
70 | }
71 |
72 | @Override
73 | public synchronized void onTestSkipped(ITestResult result) {
74 | ((ExtentTest)test.get()).skip(result.getThrowable());
75 | }
76 |
77 | @Override
78 | public synchronized void onTestFailedButWithinSuccessPercentage(ITestResult result) {
79 |
80 | }
81 | }
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | selenium_java
8 | selenium
9 | 1.0-SNAPSHOT
10 | jar
11 |
12 |
13 | UTF-8
14 | -Dfile.encoding=UTF-8
15 |
16 |
17 |
18 |
19 |
20 | org.apache.maven.plugins
21 | maven-compiler-plugin
22 | 3.6.1
23 |
24 | 1.8
25 | 1.8
26 |
27 |
28 |
29 | org.apache.maven.plugins
30 | maven-surefire-plugin
31 | 2.20
32 |
33 |
34 | res/testng.xml
35 |
36 |
37 |
38 |
39 | failsafe-integration-tests
40 | integration-test
41 |
42 | integration-test
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | org.seleniumhq.selenium
53 | selenium-java
54 | 3.4.0
55 |
56 |
57 | log4j
58 | log4j
59 | 1.2.17
60 |
61 |
62 | org.seleniumhq.selenium
63 | selenium-chrome-driver
64 | 3.4.0
65 |
66 |
67 | com.esotericsoftware.yamlbeans
68 | yamlbeans
69 | 1.11
70 |
71 |
72 |
73 |
74 | com.aventstack
75 | extentreports
76 | 3.0.5
77 |
78 |
85 |
86 | org.testng
87 | testng
88 | 6.11
89 |
90 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/src/main/java/browser/TestBaseSetup1.java:
--------------------------------------------------------------------------------
1 | package browser;
2 |
3 | import org.openqa.selenium.Platform;
4 | import org.openqa.selenium.WebDriver;
5 | import org.openqa.selenium.chrome.ChromeDriver;
6 | import org.openqa.selenium.chrome.ChromeOptions;
7 | import org.openqa.selenium.firefox.FirefoxDriver;
8 | import org.openqa.selenium.remote.DesiredCapabilities;
9 | import org.openqa.selenium.remote.RemoteWebDriver;
10 | import org.testng.annotations.AfterClass;
11 | import org.testng.annotations.BeforeClass;
12 | import org.testng.annotations.Parameters;
13 | import util.ExtentTestNGIReporterListener;
14 |
15 | import java.net.MalformedURLException;
16 | import java.net.URL;
17 | import java.util.Objects;
18 |
19 | public class TestBaseSetup1 {
20 | private WebDriver driver;
21 | // static String driverPath = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\";
22 |
23 | public WebDriver getDriver() {
24 | return driver;
25 | }
26 |
27 | private void setDriver(String browserType, String appURL, String driverPath, String version, String remoteip) {
28 | if (browserType.equals("chrome")) {
29 | driver = initChromeDriver(appURL, driverPath, version, remoteip);
30 |
31 | } else if (browserType.equals("firefox")) {
32 | driver = initFirefoxDriver(appURL);
33 |
34 | } else {
35 | System.out.println("browser : " + browserType
36 | + " is invalid, Launching Firefox as browser of choice..");
37 | driver = initFirefoxDriver(appURL);
38 | }
39 | }
40 |
41 |
42 | private static WebDriver initChromeDriver(String appURL, String driverPath, String chrome_version, String remoteip) {
43 | WebDriver driver = null;
44 | if (chrome_version == null || Objects.equals(chrome_version, "") || remoteip == null || Objects.equals(remoteip, "")) {
45 | System.setProperty("webdriver.chrome.driver", driverPath
46 | + "chromedriver.exe");
47 | driver = new ChromeDriver();
48 | driver.manage().window().maximize();
49 | driver.navigate().to(appURL);
50 | } else {
51 | DesiredCapabilities desiredCaps = new DesiredCapabilities("chrome", chrome_version, Platform.WINDOWS);
52 |
53 | try {
54 | driver = new RemoteWebDriver(new URL("http://" + remoteip + ":4444/wd/hub/"), desiredCaps);
55 | driver.manage().window().maximize();
56 | driver.navigate().to(appURL);
57 | } catch (MalformedURLException e) {
58 | e.printStackTrace();
59 | }
60 | }
61 |
62 | return driver;
63 |
64 | }
65 |
66 | private static WebDriver initFirefoxDriver(String appURL) {
67 | System.out.println("Launching Firefox browser..");
68 | WebDriver driver = new FirefoxDriver();
69 | driver.manage().window().maximize();
70 | driver.navigate().to(appURL);
71 | return driver;
72 | }
73 |
74 |
75 | @Parameters({ "browserType", "appURL" ,"driverPath","version", "remoteip"})
76 | @BeforeClass
77 | public synchronized void initializeTestBaseSetup(String browserType, String appURL, String driverPath, String version, String remoteip) {
78 | try {
79 | setDriver(browserType, appURL, driverPath,version, remoteip);
80 | // ExtentTestNGIReporterListener.driver = driver;
81 | } catch (Exception e) {
82 | System.out.println("Error....." + e.getStackTrace());
83 | }
84 | }
85 |
86 | @AfterClass
87 | public synchronized void tearDown() {
88 | driver.quit();
89 | }
90 | }
--------------------------------------------------------------------------------
/src/main/java/browser/TestBaseSetup.java:
--------------------------------------------------------------------------------
1 | package browser;
2 |
3 | import org.openqa.selenium.Platform;
4 | import org.openqa.selenium.WebDriver;
5 | import org.openqa.selenium.chrome.ChromeDriver;
6 | import org.openqa.selenium.chrome.ChromeOptions;
7 | import org.openqa.selenium.firefox.FirefoxDriver;
8 | import org.openqa.selenium.remote.DesiredCapabilities;
9 | import org.openqa.selenium.remote.RemoteWebDriver;
10 | import org.testng.annotations.AfterClass;
11 | import org.testng.annotations.BeforeClass;
12 | import org.testng.annotations.Parameters;
13 | import util.ExtentTestNGIReporterListener;
14 |
15 | import java.net.MalformedURLException;
16 | import java.net.URL;
17 | import java.util.Objects;
18 |
19 | public class TestBaseSetup {
20 | private WebDriver driver = null;
21 |
22 | public WebDriver setDriver(String browserType, String appURL, String version, String remoteip) {
23 | if (browserType.equals("chrome")) {
24 | driver = initChromeDriver(appURL, version, remoteip);
25 |
26 | } else if (browserType.equals("firefox")) {
27 | driver = initFirefoxDriver(appURL, version, remoteip);
28 |
29 | } else {
30 | System.out.println("browser : " + browserType
31 | + " is invalid, Launching Firefox as browser of choice..");
32 | driver = initFirefoxDriver(appURL, version, remoteip);
33 | }
34 | return driver;
35 | }
36 |
37 |
38 | private WebDriver initChromeDriver(String appURL, String chrome_version, String remoteip) {
39 |
40 | // System.setProperty("webdriver.chrome.driver", driverPath
41 | // + "chromedriver.exe");
42 | if (Objects.equals(chrome_version, "") || Objects.equals(remoteip, "")) {
43 | driver = new ChromeDriver();
44 | driver.manage().window().maximize();
45 | driver.navigate().to(appURL);
46 | } else {
47 | DesiredCapabilities chromeDesiredcap = DesiredCapabilities.chrome();
48 | // DesiredCapabilities chromeDesiredca=new DesiredCapabilities("chrome", "48.0.2564.109", Platform.LINUX);
49 | // RemoteWebDriver r = new RemoteWebDriver(new URL("http://192.168.99.100:4444/wd/hub/"),desiredCaps);
50 |
51 | chromeDesiredcap.setVersion(chrome_version);
52 |
53 | try {
54 | driver = new RemoteWebDriver(new URL("http://" + remoteip + ":4444/wd/hub/"), chromeDesiredcap);
55 | driver.manage().window().maximize();
56 | driver.navigate().to(appURL);
57 | } catch (MalformedURLException e) {
58 | e.printStackTrace();
59 | }
60 | }
61 |
62 | return driver;
63 |
64 | }
65 |
66 | private WebDriver initFirefoxDriver(String appURL, String version, String remoteip) {
67 |
68 | if (Objects.equals(version, "") || Objects.equals(remoteip, "")) {
69 | driver = new FirefoxDriver();
70 | driver.manage().window().maximize();
71 | driver.navigate().to(appURL);
72 | } else {
73 | DesiredCapabilities ffDesiredcap= new DesiredCapabilities("firefox", version, Platform.LINUX);
74 |
75 | ffDesiredcap.setVersion(version);
76 | // WebDriverdriver = newRemoteWebDriver(new URL(“http://192.168.99.100:4444/wd/hub/”),ffDesiredcap);
77 |
78 | try {
79 | driver = new RemoteWebDriver(new URL("http://" + remoteip + ":4444/wd/hub/"), ffDesiredcap);
80 | driver.manage().window().maximize();
81 | driver.navigate().to(appURL);
82 | } catch (MalformedURLException e) {
83 | e.printStackTrace();
84 | }
85 | }
86 |
87 | System.out.println("Launching Firefox browser..");
88 | return driver;
89 | }
90 | }
--------------------------------------------------------------------------------
/target/surefire-reports/junitreports/TEST-test.ApplyContinueTest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/target/surefire-reports/testng-reports.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 | $('a.navigator-link').click(function() {
3 | // Extract the panel for this link
4 | var panel = getPanelName($(this));
5 |
6 | // Mark this link as currently selected
7 | $('.navigator-link').parent().removeClass('navigator-selected');
8 | $(this).parent().addClass('navigator-selected');
9 |
10 | showPanel(panel);
11 | });
12 |
13 | installMethodHandlers('failed');
14 | installMethodHandlers('skipped');
15 | installMethodHandlers('passed', true); // hide passed methods by default
16 |
17 | $('a.method').click(function() {
18 | showMethod($(this));
19 | return false;
20 | });
21 |
22 | // Hide all the panels and display the first one (do this last
23 | // to make sure the click() will invoke the listeners)
24 | $('.panel').hide();
25 | $('.navigator-link').first().click();
26 |
27 | // Collapse/expand the suites
28 | $('a.collapse-all-link').click(function() {
29 | var contents = $('.navigator-suite-content');
30 | if (contents.css('display') == 'none') {
31 | contents.show();
32 | } else {
33 | contents.hide();
34 | }
35 | });
36 | });
37 |
38 | // The handlers that take care of showing/hiding the methods
39 | function installMethodHandlers(name, hide) {
40 | function getContent(t) {
41 | return $('.method-list-content.' + name + "." + t.attr('panel-name'));
42 | }
43 |
44 | function getHideLink(t, name) {
45 | var s = 'a.hide-methods.' + name + "." + t.attr('panel-name');
46 | return $(s);
47 | }
48 |
49 | function getShowLink(t, name) {
50 | return $('a.show-methods.' + name + "." + t.attr('panel-name'));
51 | }
52 |
53 | function getMethodPanelClassSel(element, name) {
54 | var panelName = getPanelName(element);
55 | var sel = '.' + panelName + "-class-" + name;
56 | return $(sel);
57 | }
58 |
59 | $('a.hide-methods.' + name).click(function() {
60 | var w = getContent($(this));
61 | w.hide();
62 | getHideLink($(this), name).hide();
63 | getShowLink($(this), name).show();
64 | getMethodPanelClassSel($(this), name).hide();
65 | });
66 |
67 | $('a.show-methods.' + name).click(function() {
68 | var w = getContent($(this));
69 | w.show();
70 | getHideLink($(this), name).show();
71 | getShowLink($(this), name).hide();
72 | showPanel(getPanelName($(this)));
73 | getMethodPanelClassSel($(this), name).show();
74 | });
75 |
76 | if (hide) {
77 | $('a.hide-methods.' + name).click();
78 | } else {
79 | $('a.show-methods.' + name).click();
80 | }
81 | }
82 |
83 | function getHashForMethod(element) {
84 | return element.attr('hash-for-method');
85 | }
86 |
87 | function getPanelName(element) {
88 | return element.attr('panel-name');
89 | }
90 |
91 | function showPanel(panelName) {
92 | $('.panel').hide();
93 | var panel = $('.panel[panel-name="' + panelName + '"]');
94 | panel.show();
95 | }
96 |
97 | function showMethod(element) {
98 | var hashTag = getHashForMethod(element);
99 | var panelName = getPanelName(element);
100 | showPanel(panelName);
101 | var current = document.location.href;
102 | var base = current.substring(0, current.indexOf('#'))
103 | document.location.href = base + '#' + hashTag;
104 | var newPosition = $(document).scrollTop() - 65;
105 | $(document).scrollTop(newPosition);
106 | }
107 |
108 | function drawTable() {
109 | for (var i = 0; i < suiteTableInitFunctions.length; i++) {
110 | window[suiteTableInitFunctions[i]]();
111 | }
112 |
113 | for (var k in window.suiteTableData) {
114 | var v = window.suiteTableData[k];
115 | var div = v.tableDiv;
116 | var data = v.tableData
117 | var table = new google.visualization.Table(document.getElementById(div));
118 | table.draw(data, {
119 | showRowNumber : false
120 | });
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/src/main/java/pageobjects/LoginPage.java:
--------------------------------------------------------------------------------
1 | package pageobjects;
2 |
3 | import com.esotericsoftware.yamlbeans.YamlException;
4 | import model.CheckPoint;
5 | import model.TestCase;
6 | import org.apache.commons.io.FileUtils;
7 | import org.openqa.selenium.OutputType;
8 | import org.openqa.selenium.TakesScreenshot;
9 | import org.openqa.selenium.WebDriver;
10 | import org.testng.ITestContext;
11 | import util.ExtentTestNGIReporterListener;
12 | import util.OperateElement;
13 | import util.YamlRead;
14 |
15 | import java.io.File;
16 | import java.io.FileNotFoundException;
17 | import java.io.IOException;
18 | import java.util.List;
19 | import java.util.Map;
20 | import java.util.UUID;
21 | import java.util.concurrent.TimeUnit;
22 |
23 | public class LoginPage {
24 | YamlRead yamlRead;
25 | OperateElement operateElement;
26 | protected WebDriver driver;
27 | private boolean isOperate = true;
28 | /***
29 | * 默认构造函数
30 | * @param driver
31 | * @param path yaml配置参数
32 | */
33 | public LoginPage(WebDriver driver, String path) {
34 | this.driver = driver;
35 | yamlRead = new YamlRead(path);
36 | operateElement= new OperateElement(this.driver);
37 | }
38 |
39 | /***
40 | * 测试步骤
41 | * @throws YamlException
42 | * @throws FileNotFoundException
43 | */
44 | public void operate() throws YamlException, FileNotFoundException, InterruptedException {
45 | List list = (List) yamlRead.getYmal().get("testcase");
46 | // System.out.println(list);
47 | for(Object item: list){
48 | TestCase testCase = new TestCase();
49 | testCase.setFind_type((String) ((Map)item).get("find_type"));
50 | testCase.setElement_info((String) ((Map)item).get("element_info"));
51 | testCase.setText((String) ((Map)item).get("text"));
52 | testCase.setOperate_type((String) ((Map)item).get("operate_type"));
53 | if (!operateElement.operate(testCase)) {
54 | isOperate = false;
55 | System.out.println("操作失败");
56 | break;
57 | }
58 |
59 | }
60 | }
61 |
62 | /***
63 | * 检查点
64 | * @return
65 | * @throws YamlException
66 | * @throws FileNotFoundException
67 | */
68 | public boolean checkpoint(String browserType) throws YamlException, FileNotFoundException, InterruptedException {
69 | if (!isOperate) { // 如果操作步骤失败,检查点也就判断失败
70 | System.out.println("前置条件失败");
71 | TakesScreenshot(browserType);
72 | return false;
73 | }
74 | List list = (List) yamlRead.getYmal().get("check");
75 | for(Object item: list){
76 | CheckPoint checkPoint = new CheckPoint();
77 | checkPoint.setElement_info((String) ((Map)item).get("element_info"));
78 | checkPoint.setFind_type((String) ((Map)item).get("find_type"));
79 | if (!operateElement.checkElement(checkPoint)) {
80 | TakesScreenshot(browserType);
81 | return false;
82 | }
83 | }
84 |
85 | return true;
86 | }
87 |
88 | public void TakesScreenshot(String browserType) {
89 | File directory = new File("test-output");
90 | try {
91 | String screenPath = directory.getCanonicalPath() + "\\";
92 | File file = new File(screenPath);
93 | if (!file.exists()) {
94 | file.mkdirs();
95 | }
96 | System.out.println("------------检查点失败--------");
97 | // this.driver.switchTo().defaultContent();
98 | String fileName = screenPath + browserType + "_" + UUID.randomUUID().toString() + ".png";
99 | driver.switchTo().defaultContent();
100 | File srcFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
101 | FileUtils.copyFile(srcFile, new File(fileName));
102 |
103 | ExtentTestNGIReporterListener.fileName = fileName;
104 | } catch (IOException e) {
105 | e.printStackTrace();
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/target/surefire-reports/emailable-report.html:
--------------------------------------------------------------------------------
1 |
2 | TestNG Report Test # Passed # Skipped # Failed Time (ms) Included Groups Excluded Groups wiseoper 登录 1 0 0 13,051 账号延期 0 0 1 33,118 Total 1 0 1 46,169
Class Method Start Time (ms) wiseoper 登录 — passed test.LoginTest testLogin 1499248054300 7915 账号延期 — failed test.ApplyContinueTest testApplyContinue 1499248067212 28139
登录 test.LoginTest#testLogin back to summary
账号延期 test.ApplyContinueTest#testApplyContinue Exception org.openqa.selenium.TimeoutException: Expected condition failed: waiting for presence of element located by: By.xpath: //*[@id="wiseoper-content"]/div[3]/div/div[1]/span[3] (tried for 10 second(s) with 500 MILLISECONDS interval)
3 | at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:80)
4 | at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:232)
5 | at util.OperateElement.waitForElement(OperateElement.java:99)
6 | at util.OperateElement.checkElement(OperateElement.java:43)
7 | at pageobjects.ApplyContinuePage.checkpoint(ApplyContinuePage.java:103)
8 | at test.ApplyContinueTest.testApplyContinue(ApplyContinueTest.java:32)
9 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
10 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
11 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
12 | at java.lang.Thread.run(Thread.java:745)
13 | Caused by: org.openqa.selenium.NoSuchElementException: Cannot locate an element using By.xpath: //*[@id="wiseoper-content"]/div[3]/div/div[1]/span[3]
14 | For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
15 | Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
16 | System info: host: '4CV65290DX', ip: '192.168.1.180', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'
17 | Driver info: driver.version: unknown
18 | at org.openqa.selenium.support.ui.ExpectedConditions.lambda$findElement$0(ExpectedConditions.java:883)
19 | at java.util.Optional.orElseThrow(Optional.java:290)
20 | at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:882)
21 | at org.openqa.selenium.support.ui.ExpectedConditions.access$000(ExpectedConditions.java:44)
22 | at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:183)
23 | at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:180)
24 | at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:209)
25 | ... 24 more
26 | ... Removed 16 stack frames
back to summary
--------------------------------------------------------------------------------
/src/main/java/util/ElementLocator.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 | import java.util.HashMap;
6 | import java.util.List;
7 |
8 | import org.openqa.selenium.By;
9 | import org.openqa.selenium.SearchContext;
10 | import org.openqa.selenium.WebDriver;
11 | import org.openqa.selenium.WebElement;
12 |
13 | public abstract class ElementLocator {
14 | private final static String LOCATE_ID = "id";
15 | private final static String LOCATE_NAME = "name";
16 | private final static String LOCATE_LINKTEXT = "linkText";
17 | private final static String LOCATE_PARTIALINKTEXT = "partialLinkText";
18 | private final static String LOCATE_TAGNAME = "tagName";
19 | private final static String LOCATE_CLASSNAME = "className";
20 | private final static String LOCATE_XPATH = "xpath";
21 |
22 | private ElementLocator parent;
23 |
24 | public ElementLocator() {
25 | parent = null;
26 | }
27 |
28 | // private static class LazyHolder {
29 | // private static final CommonFunction INSTANCE = new CommonFunction();
30 | // }
31 | // private CommonFunction(){}
32 | // public static final CommonFunction getInstance() {
33 | // return LazyHolder.INSTANCE;
34 | // }
35 |
36 | public static ElementLocator create(final String expr) {
37 | String[] sType = expr.split("::");
38 | if (sType[0].equalsIgnoreCase(LOCATE_ID)) {
39 | return id(sType[1]);
40 | } else if (sType[0].equalsIgnoreCase(LOCATE_NAME)) {
41 | return name(sType[1]);
42 | } else if (sType[0].equalsIgnoreCase(LOCATE_LINKTEXT)) {
43 | return linkText(sType[1]);
44 | } else if (sType[0].equalsIgnoreCase(LOCATE_PARTIALINKTEXT)) {
45 | return partialLinkText(sType[1]);
46 | } else if (sType[0].equalsIgnoreCase(LOCATE_TAGNAME)) {
47 | return tagName(sType[1]);
48 | } else if (sType[0].equalsIgnoreCase(LOCATE_CLASSNAME)) {
49 | return className(sType[1]);
50 | } else if (sType[0].equalsIgnoreCase(LOCATE_XPATH)) {
51 | return xPath(sType[1]);
52 | }else{
53 | System.out.println("参数不能解析,未知类型:" + expr);
54 | return null;
55 | }
56 | }
57 |
58 | public static ElementLocator id(final String id) {
59 | return new SeleniumElementLocator(By.id(id));
60 | }
61 |
62 | public static ElementLocator name(final String name) {
63 | return new SeleniumElementLocator(By.name(name));
64 | }
65 |
66 | public static ElementLocator linkText(final String text) {
67 | return new SeleniumElementLocator(By.linkText(text));
68 | }
69 |
70 | public static ElementLocator partialLinkText(final String text) {
71 | return new SeleniumElementLocator(By.partialLinkText(text));
72 | }
73 |
74 | public static ElementLocator tagName(final String name) {
75 | return new SeleniumElementLocator(By.tagName(name));
76 | }
77 |
78 | public static ElementLocator className(final String name) {
79 | return new SeleniumElementLocator(By.className(name));
80 | }
81 |
82 | public static ElementLocator xPath(final String expr) {
83 | return new SeleniumElementLocator(By.xpath(expr));
84 | }
85 |
86 | public static ElementLocator element(final WebElement element) {
87 | return new DirectElementLocator(element);
88 | }
89 |
90 | public abstract List findElements(WebDriver driver);
91 |
92 | public abstract WebElement locate(WebDriver driver);
93 |
94 | public void setParent(ElementLocator parent) {
95 | this.parent = parent;
96 | }
97 |
98 | public ElementLocator getParent() {
99 | return parent;
100 | }
101 | }
102 |
103 | class SeleniumElementLocator extends ElementLocator {
104 | private By by;
105 |
106 | public SeleniumElementLocator(By by) {
107 | this.by = by;
108 | }
109 |
110 | public List findElements(WebDriver driver) {
111 | SearchContext parentElement = driver;
112 | if (getParent() != null) {
113 | parentElement = getParent().locate(driver);
114 | }
115 |
116 | return parentElement.findElements(by);
117 | }
118 |
119 | public WebElement locate(WebDriver driver) {
120 | SearchContext parentElement = driver;
121 | if (getParent() != null) {
122 | parentElement = getParent().locate(driver);
123 | }
124 |
125 | WebElement element = parentElement.findElement(by);
126 | return element;
127 | }
128 | }
129 |
130 |
131 | class DirectElementLocator extends ElementLocator {
132 | private ArrayList elementList;
133 |
134 | public DirectElementLocator(WebElement element) {
135 | elementList = new ArrayList();
136 | elementList.add(element);
137 | }
138 |
139 | public List findElements(WebDriver driver) {
140 | return elementList;
141 | }
142 |
143 | public WebElement locate(WebDriver driver) {
144 | return elementList.get(0);
145 | }
146 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # selenium3 java
2 | * window7_X64
3 | * maven
4 | * testng
5 | * write testCase use yaml
6 | * PageObject
7 | * docker
8 |
9 | # config
10 |
11 | - config [pom.xml](pom.xml)
12 | - config [testng](res/testng.xml)
13 | - config [log4j](res/log4j.properties)
14 | - exec ```docker-compose up```
15 |
16 | # Example
17 |
18 | - login testcase
19 |
20 | **PageObject**
21 |
22 | All page are made up of three parts:
23 |
24 | * constructor
25 | * operation method
26 | * checkPoint
27 |
28 | ```
29 | public class LoginPage {
30 | YamlRead yamlRead;
31 | OperateElement operateElement;
32 | protected WebDriver driver;
33 | private boolean isOperate = true;
34 | /***
35 | *
36 | * @param driver
37 | * @param path yaml
38 | */
39 | public LoginPage(WebDriver driver, String path) {
40 | this.driver = driver;
41 | yamlRead = new YamlRead(path);
42 | operateElement= new OperateElement(this.driver);
43 | }
44 |
45 | /***
46 | * operate setp
47 | * @throws YamlException
48 | * @throws FileNotFoundException
49 | */
50 | public void operate() throws YamlException, FileNotFoundException, InterruptedException {
51 | List list = (List) yamlRead.getYmal().get("testcase");
52 | // System.out.println(list);
53 | for(Object item: list){
54 | TestCase testCase = new TestCase();
55 | testCase.setFind_type((String) ((Map)item).get("find_type"));
56 | testCase.setElement_info((String) ((Map)item).get("element_info"));
57 | testCase.setText((String) ((Map)item).get("text"));
58 | testCase.setOperate_type((String) ((Map)item).get("operate_type"));
59 | if (!operateElement.operate(testCase)) {
60 | isOperate = false;
61 | System.out.println("operate failed");
62 | break;
63 | }
64 |
65 | }
66 | }
67 |
68 | /***
69 | * checkPoint
70 | * @return
71 | * @throws YamlException
72 | * @throws FileNotFoundException
73 | */
74 | public boolean checkpoint() throws YamlException, FileNotFoundException, InterruptedException {
75 | if (!isOperate) { // If the operation step fails, the checkpoint fails
76 | System.out.println("operate failed");
77 | return false;
78 | }
79 | List list = (List) yamlRead.getYmal().get("check");
80 | for(Object item: list){
81 | CheckPoint checkPoint = new CheckPoint();
82 | checkPoint.setElement_info((String) ((Map)item).get("element_info"));
83 | checkPoint.setFind_type((String) ((Map)item).get("find_type"));
84 | if (!operateElement.checkElement(checkPoint)) {
85 | return false;
86 | }
87 | }
88 |
89 | return true;
90 | }
91 |
92 | ```
93 |
94 | **login yaml**
95 |
96 | ```
97 | testcase:
98 | - element_info: user_login
99 | find_type: id
100 | operate_type: send_keys
101 | text: lose
102 | - element_info: user[password]
103 | find_type: name
104 | operate_type: send_keys
105 | text: password
106 | - element_info: //*[@id="new_user"]/div[4]/input
107 | find_type: xpath
108 | operate_type: click
109 | check:
110 | - element_info: /html/body/div[1]/nav/div/ul[1]/li/a/img
111 | find_type: xpath
112 | - element_info: /html/body/div[1]/nav/div/ul[2]/li[2]/a
113 | find_type: xpath
114 |
115 | ```
116 |
117 |
118 | **login test**
119 |
120 | ```
121 | public class LoginTest {
122 | private WebDriver driver;
123 | private TestBaseSetup testBaseSetup = new TestBaseSetup();
124 |
125 |
126 | @Parameters({ "browserType", "appURL" ,"driverPath","browserVersion", "remoteIP"})
127 | @BeforeClass
128 | public void setUp(String browserType, String appURL, String driverPath, String browserVersion, String remoteIP) {
129 | driver = testBaseSetup.setDriver(browserType, appURL, driverPath,browserVersion, remoteIP);
130 | }
131 |
132 | @Test
133 | public void testLogin() throws YamlException, FileNotFoundException, InterruptedException {
134 | LoginPage loginPage = new LoginPage(this.driver, "/Login.yaml");
135 | loginPage.operate();
136 | Assert.assertTrue(loginPage.checkpoint(), "checkPoint is failed");
137 |
138 | }
139 |
140 | @AfterClass
141 | public void tearDown() {
142 |
143 | this.driver.quit();
144 | }
145 | }
146 | ```
147 |
148 |
149 | # execute
150 |
151 | ``` mvn test```
152 |
153 | 
154 |
155 |
156 | **report**
157 |
158 | 
159 |
160 |
161 | # other
162 | * [Chinese](chinese.md)
163 |
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/target/surefire-reports/TesterHome/社区.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | TestNG: 社区
4 |
5 |
6 |
7 |
11 |
53 |
54 |
55 |
56 | 社区
57 |
58 | Tests passed/Failed/Skipped: 0/1/0
59 |
60 | Started on: Tue May 23 17:06:05 CST 2017
61 |
62 | Total time: 17 seconds (17785 ms)
63 |
64 | Included groups:
65 |
66 | Excluded groups:
67 |
68 |
69 | (Hover the method name to see the test class name)
70 |
71 | FAILED TESTS
72 | Test method
73 | Exception
74 | Time (seconds)
75 | Instance
76 |
77 |
78 | testMyInfo Test class: test.MyinfoPageTest
79 | java.lang.AssertionError: 检查点不通过 expected [true] but found [false]
80 | at test.MyinfoPageTest.testMyInfo(MyinfoPageTest.java:30)
81 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
82 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
83 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
84 | at java.lang.Thread.run(Thread.java:745)
85 | ... Removed 19 stack frames Click to show all stack frames
86 | java.lang.AssertionError: 检查点不通过 expected [true] but found [false]
87 | at org.testng.Assert.fail(Assert.java:93)
88 | at org.testng.Assert.failNotEquals(Assert.java:512)
89 | at org.testng.Assert.assertTrue(Assert.java:41)
90 | at test.MyinfoPageTest.testMyInfo(MyinfoPageTest.java:30)
91 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
92 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
93 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
94 | at java.lang.reflect.Method.invoke(Method.java:498)
95 | at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
96 | at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
97 | at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
98 | at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
99 | at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
100 | at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
101 | at org.testng.TestRunner.privateRun(TestRunner.java:744)
102 | at org.testng.TestRunner.run(TestRunner.java:602)
103 | at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
104 | at org.testng.SuiteRunner.access$000(SuiteRunner.java:39)
105 | at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:414)
106 | at org.testng.internal.thread.ThreadUtil$1.call(ThreadUtil.java:52)
107 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
108 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
109 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
110 | at java.lang.Thread.run(Thread.java:745)
111 |
112 | 6
113 | test.MyinfoPageTest@9629756
114 |
115 |
116 |
--------------------------------------------------------------------------------
/src/main/java/pageobjects/ApplyContinuePage.java:
--------------------------------------------------------------------------------
1 | package pageobjects;
2 |
3 | import com.esotericsoftware.yamlbeans.YamlException;
4 | import model.CheckPoint;
5 | import model.TestCase;
6 | import org.apache.commons.io.FileUtils;
7 | import org.openqa.selenium.OutputType;
8 | import org.openqa.selenium.TakesScreenshot;
9 | import org.openqa.selenium.WebDriver;
10 | import util.ExtentTestNGIReporterListener;
11 | import util.OperateElement;
12 | import util.YamlRead;
13 | import util.WebBrower;
14 |
15 | import java.io.File;
16 | import java.io.FileNotFoundException;
17 | import java.io.IOException;
18 | import java.util.List;
19 | import java.util.Map;
20 | import java.util.Objects;
21 | import java.util.UUID;
22 |
23 | /**
24 | * Created by shikun on 2017/7/3.
25 | */
26 | public class ApplyContinuePage {
27 | YamlRead yamlRead;
28 | OperateElement operateElement;
29 | protected WebDriver driver;
30 | private boolean isOperate = true;
31 | private WebBrower webBrower;
32 | /***
33 | * 默认构造函数
34 | * @param driver
35 | * @param path yaml配置参数
36 | */
37 | public ApplyContinuePage(WebDriver driver, String path) {
38 | this.driver = driver;
39 | yamlRead = new YamlRead(path);
40 | operateElement = new OperateElement(this.driver);
41 | webBrower = new WebBrower(this.driver);
42 | }
43 |
44 | /***
45 | * 前置步骤,打开账号延期申请工作流,切换到iframe
46 | */
47 | private void prefix() throws YamlException, FileNotFoundException, InterruptedException {
48 | List list = (List) yamlRead.getYmal().get("prefix");
49 | System.out.println(list);
50 | try {
51 | for (Object item : list) {
52 | TestCase testCase = new TestCase();
53 | testCase.setFind_type((String) ((Map) item).get("find_type"));
54 | testCase.setElement_info((String) ((Map) item).get("element_info"));
55 | testCase.setText((String) ((Map) item).get("text"));
56 | testCase.setOperate_type((String) ((Map) item).get("operate_type"));
57 | testCase.setFrame((String) ((Map) item).get("frame")); //切到iframe
58 | if (!operateElement.operate(testCase)) {
59 | isOperate = false;
60 | System.out.println("前置条件失败");
61 | break;
62 | }
63 | }
64 | }
65 | catch (org.openqa.selenium.NoSuchFrameException e) {
66 | System.out.println("切换frame失败");
67 | isOperate = false;
68 | }
69 |
70 | }
71 |
72 | /***
73 | * 测试步骤
74 | * @throws YamlException
75 | * @throws FileNotFoundException
76 | */
77 | public void operate() throws YamlException, FileNotFoundException, InterruptedException {
78 |
79 | prefix();
80 | if (!isOperate) { // 如果操前置条件失败,操作步骤就不用执行
81 | System.out.println("前置条件失败");
82 | } else {
83 | List list = (List) yamlRead.getYmal().get("testcase");
84 | // System.out.println(list);
85 | for (Object item : list) {
86 | TestCase testCase = new TestCase();
87 | testCase.setFind_type((String) ((Map) item).get("find_type"));
88 | testCase.setElement_info((String) ((Map) item).get("element_info"));
89 | testCase.setText((String) ((Map) item).get("text"));
90 | testCase.setOperate_type((String) ((Map) item).get("operate_type"));
91 | testCase.setDefaultContent((String) ((Map) item).get("defaultContent")); // 切回主页面
92 | if (!operateElement.operate(testCase)) {
93 | isOperate = false;
94 | System.out.println("操作失败");
95 | break;
96 | }
97 |
98 | }
99 | }
100 | }
101 |
102 | /***
103 | * 检查点
104 | * @return
105 | * @throws YamlException
106 | * @throws FileNotFoundException
107 | */
108 | public boolean checkpoint(String browserType) throws YamlException, FileNotFoundException, InterruptedException {
109 | if (!isOperate) { // 如果操作步骤失败,检查点也就判断失败
110 | System.out.println("操作失败");
111 | TakesScreenshot(browserType);
112 | return false;
113 | }
114 | List list = (List) yamlRead.getYmal().get("check");
115 | for (Object item : list) {
116 | CheckPoint checkPoint = new CheckPoint();
117 | checkPoint.setElement_info((String) ((Map) item).get("element_info"));
118 | checkPoint.setFind_type((String) ((Map) item).get("find_type"));
119 | if (!operateElement.checkElement(checkPoint)) {
120 | TakesScreenshot(browserType);
121 | return false;
122 | }
123 | }
124 | return true;
125 | }
126 |
127 | public void TakesScreenshot(String browserType) {
128 | File directory = new File("test-output");
129 | try {
130 | String screenPath = directory.getCanonicalPath() + "\\";
131 | File file = new File(screenPath);
132 | if (!file.exists()) {
133 | file.mkdirs();
134 | }
135 | System.out.println("------------检查点失败--------");
136 | String fileName = screenPath + browserType + "_" + UUID.randomUUID().toString() + ".png";
137 | driver.switchTo().defaultContent();
138 | File srcFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
139 | FileUtils.copyFile(srcFile, new File(fileName));
140 |
141 | ExtentTestNGIReporterListener.fileName = fileName;
142 | } catch (IOException e) {
143 | e.printStackTrace();
144 | }
145 | }
146 |
147 | }
--------------------------------------------------------------------------------
/src/main/java/util/OperateElement.java:
--------------------------------------------------------------------------------
1 | package util;
2 | import model.CheckPoint;
3 | import model.TestCase;
4 | import org.openqa.selenium.*;
5 | import org.openqa.selenium.support.ui.ExpectedCondition;
6 | import org.openqa.selenium.support.ui.ExpectedConditions;
7 | import org.openqa.selenium.support.ui.WebDriverWait;
8 |
9 | import java.util.Map;
10 | import java.util.Objects;
11 | import java.util.concurrent.TimeUnit;
12 |
13 | /**
14 | * 常用元素操作类
15 | */
16 | public class OperateElement {
17 | WebDriver driver;
18 | private final int TIMEOUT = 10;
19 | private static final String NAME = "name";
20 | private static final String XPATH = "xpath";
21 | private static final String CLASSNAME = "className";
22 | private static final String CSSSELECTOR = "cssSelector";
23 | private static final String ID = "id";
24 | WebDriverWait wait;
25 | WebBrower webBrower;
26 | public OperateElement(WebDriver driver) {
27 | this.driver = driver;
28 | wait = new WebDriverWait(this.driver,TIMEOUT);
29 | webBrower = new WebBrower(this.driver);
30 |
31 | }
32 |
33 |
34 |
35 | /***
36 | *
37 | *
38 | * @param checkPoint 检查点实体类
39 | * @return
40 | */
41 | public Boolean checkElement(CheckPoint checkPoint) throws InterruptedException {
42 | final By by = getElement(checkPoint.getFind_type(), checkPoint.getElement_info());
43 | boolean status = waitForElement(by);
44 | if (checkPoint.getOperate_type() == null) { // Operate_type为空的话,默认就是find查找
45 | return status;
46 | } else if ((checkPoint.getOperate_type().equals("getValue") && checkPoint.getText() != null)) { //具体检查点
47 | status = driver.findElement(by).getAttribute("value").equals(checkPoint.getText());
48 | System.out.println("查找点为=" + checkPoint.getText());
49 | } else {
50 | status = false;
51 | }
52 | return status;
53 | }
54 |
55 | /***
56 | * 得到元素
57 | * @param find_type (id,xpath,name,classname)
58 | * @param element_info 具体元素信息
59 | * @return By
60 | */
61 | public By getElement(String find_type, String element_info){
62 | By by = null;
63 | switch (find_type) {
64 | case ID:
65 | by = By.id(element_info);
66 |
67 | break;
68 | case NAME:
69 | by = By.name(element_info);
70 |
71 | break;
72 | case XPATH:
73 | by = By.xpath(element_info);
74 |
75 | break;
76 | case CSSSELECTOR:
77 | by = new By.ByCssSelector(element_info);
78 | break;
79 | default:
80 | System.out.println("不支持其他操作方法" + element_info);
81 | break;
82 | }
83 | return by;
84 | }
85 |
86 | public WebElement setElement(By by){
87 | WebElement webElement = this.driver.findElement(by);
88 | return webElement;
89 |
90 | }
91 |
92 | /***
93 | * 检查元素是否存在
94 | * @param elementLocator
95 | */
96 | private boolean waitForElement(final By elementLocator) {
97 |
98 | try{
99 | wait.until(ExpectedConditions.presenceOfElementLocated(elementLocator));
100 | return true;
101 | }
102 | catch (NoSuchElementException | ElementNotVisibleException | org.openqa.selenium.TimeoutException e) {
103 | return false;
104 | }
105 | }
106 |
107 | /***
108 | * 清空文本框
109 | * webElement
110 |
111 | */
112 | public void clear(WebElement webElement) {
113 | webElement.clear();
114 | }
115 |
116 | /***
117 | * 执行步骤
118 | * TestCase 实体类
119 | * @param testCase
120 | */
121 | public boolean operate(TestCase testCase) throws InterruptedException {
122 | CheckPoint checkPoint = new CheckPoint();
123 | checkPoint.setFind_type(testCase.getFind_type());
124 | checkPoint.setElement_info(testCase.getElement_info());
125 |
126 | if (testCase.getDefaultContent()!= null) { //切换到主页面
127 | Thread.sleep(1000);
128 | webBrower.defaultContent();
129 | System.out.println("-------------getDefaultContent--------------------");
130 | System.out.println("切换到主页面");
131 | }
132 | boolean check = checkElement(checkPoint);
133 | if (check) {
134 | Thread.sleep(800);
135 | By by = getElement(testCase.getFind_type(), testCase.getElement_info());
136 | WebElement webElement = setElement(by);
137 | switch (testCase.getOperate_type()) {
138 | case "click": { // 点击
139 | webElement.click();
140 | System.out.println("点击了==" + testCase.getElement_info());
141 | break;
142 | }
143 | case "send_keys": { //输入内容
144 | clear(webElement); // 清空文本框
145 | webElement.sendKeys(testCase.getText());
146 | System.out.println(testCase.getElement_info() + ":输入内容==" + testCase.getText());
147 | break;
148 | }
149 | default:
150 | System.out.println("不支持操作方法=" + testCase.getElement_info());
151 | System.out.println("不支持操作方法=" + testCase.getOperate_type());
152 | break;
153 | }
154 | if (testCase.getFrame()!= null) { // 切换到frame
155 | Thread.sleep(1000);
156 | webBrower.switchToFrame(testCase.getFrame());
157 | System.out.println("-------------getFrame--------------------");
158 | System.out.println(testCase.getFrame());
159 | }
160 |
161 |
162 | } else {
163 | System.out.println(testCase.getElement_info()+"==元素不存在");
164 | }
165 |
166 | return check;
167 | }
168 |
169 | }
170 |
--------------------------------------------------------------------------------
/selenium_java.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/target/surefire-reports/testng-reports.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0px 0px 5px 5px;
3 | }
4 |
5 | ul {
6 | margin: 0px;
7 | }
8 |
9 | li {
10 | list-style-type: none;
11 | }
12 |
13 | a {
14 | text-decoration: none;
15 | }
16 |
17 | a:hover {
18 | text-decoration: underline;
19 | }
20 |
21 | .navigator-selected {
22 | background: #ffa500;
23 | }
24 |
25 | .wrapper {
26 | position: absolute;
27 | top: 60px;
28 | bottom: 0;
29 | left: 400px;
30 | right: 0;
31 | overflow: auto;
32 | }
33 |
34 | .navigator-root {
35 | position: absolute;
36 | top: 60px;
37 | bottom: 0;
38 | left: 0;
39 | width: 400px;
40 | overflow-y: auto;
41 | }
42 |
43 | .suite {
44 | margin: 0px 10px 10px 0px;
45 | background-color: #fff8dc;
46 | }
47 |
48 | .suite-name {
49 | padding-left: 10px;
50 | font-size: 25px;
51 | font-family: Times;
52 | }
53 |
54 | .main-panel-header {
55 | padding: 5px;
56 | background-color: #9FB4D9; //afeeee;
57 | font-family: monospace;
58 | font-size: 18px;
59 | }
60 |
61 | .main-panel-content {
62 | padding: 5px;
63 | margin-bottom: 10px;
64 | background-color: #DEE8FC; //d0ffff;
65 | }
66 |
67 | .rounded-window {
68 | border-radius: 10px;
69 | border-style: solid;
70 | border-width: 1px;
71 | }
72 |
73 | .rounded-window-top {
74 | border-top-right-radius: 10px 10px;
75 | border-top-left-radius: 10px 10px;
76 | border-style: solid;
77 | border-width: 1px;
78 | overflow: auto;
79 | }
80 |
81 | .light-rounded-window-top {
82 | border-top-right-radius: 10px 10px;
83 | border-top-left-radius: 10px 10px;
84 | }
85 |
86 | .rounded-window-bottom {
87 | border-style: solid;
88 | border-width: 0px 1px 1px 1px;
89 | border-bottom-right-radius: 10px 10px;
90 | border-bottom-left-radius: 10px 10px;
91 | overflow: auto;
92 | }
93 |
94 | .method-name {
95 | font-size: 12px;
96 | font-family: monospace;
97 | }
98 |
99 | .method-content {
100 | border-style: solid;
101 | border-width: 0px 0px 1px 0px;
102 | margin-bottom: 10;
103 | padding-bottom: 5px;
104 | width: 80%;
105 | }
106 |
107 | .parameters {
108 | font-size: 14px;
109 | font-family: monospace;
110 | }
111 |
112 | .stack-trace {
113 | white-space: pre;
114 | font-family: monospace;
115 | font-size: 12px;
116 | font-weight: bold;
117 | margin-top: 0px;
118 | margin-left: 20px;
119 | }
120 |
121 | .testng-xml {
122 | font-family: monospace;
123 | }
124 |
125 | .method-list-content {
126 | margin-left: 10px;
127 | }
128 |
129 | .navigator-suite-content {
130 | margin-left: 10px;
131 | font: 12px 'Lucida Grande';
132 | }
133 |
134 | .suite-section-title {
135 | margin-top: 10px;
136 | width: 80%;
137 | border-style: solid;
138 | border-width: 1px 0px 0px 0px;
139 | font-family: Times;
140 | font-size: 18px;
141 | font-weight: bold;
142 | }
143 |
144 | .suite-section-content {
145 | list-style-image: url(bullet_point.png);
146 | }
147 |
148 | .top-banner-root {
149 | position: absolute;
150 | top: 0;
151 | height: 45px;
152 | left: 0;
153 | right: 0;
154 | padding: 5px;
155 | margin: 0px 0px 5px 0px;
156 | background-color: #0066ff;
157 | font-family: Times;
158 | color: #fff;
159 | text-align: center;
160 | }
161 |
162 | .top-banner-title-font {
163 | font-size: 25px;
164 | }
165 |
166 | .test-name {
167 | font-family: 'Lucida Grande';
168 | font-size: 16px;
169 | }
170 |
171 | .suite-icon {
172 | padding: 5px;
173 | float: right;
174 | height: 20;
175 | }
176 |
177 | .test-group {
178 | font: 20px 'Lucida Grande';
179 | margin: 5px 5px 10px 5px;
180 | border-width: 0px 0px 1px 0px;
181 | border-style: solid;
182 | padding: 5px;
183 | }
184 |
185 | .test-group-name {
186 | font-weight: bold;
187 | }
188 |
189 | .method-in-group {
190 | font-size: 16px;
191 | margin-left: 80px;
192 | }
193 |
194 | table.google-visualization-table-table {
195 | width: 100%;
196 | }
197 |
198 | .reporter-method-name {
199 | font-size: 14px;
200 | font-family: monospace;
201 | }
202 |
203 | .reporter-method-output-div {
204 | padding: 5px;
205 | margin: 0px 0px 5px 20px;
206 | font-size: 12px;
207 | font-family: monospace;
208 | border-width: 0px 0px 0px 1px;
209 | border-style: solid;
210 | }
211 |
212 | .ignored-class-div {
213 | font-size: 14px;
214 | font-family: monospace;
215 | }
216 |
217 | .ignored-methods-div {
218 | padding: 5px;
219 | margin: 0px 0px 5px 20px;
220 | font-size: 12px;
221 | font-family: monospace;
222 | border-width: 0px 0px 0px 1px;
223 | border-style: solid;
224 | }
225 |
226 | .border-failed {
227 | border-top-left-radius: 10px 10px;
228 | border-bottom-left-radius: 10px 10px;
229 | border-style: solid;
230 | border-width: 0px 0px 0px 10px;
231 | border-color: #f00;
232 | }
233 |
234 | .border-skipped {
235 | border-top-left-radius: 10px 10px;
236 | border-bottom-left-radius: 10px 10px;
237 | border-style: solid;
238 | border-width: 0px 0px 0px 10px;
239 | border-color: #edc600;
240 | }
241 |
242 | .border-passed {
243 | border-top-left-radius: 10px 10px;
244 | border-bottom-left-radius: 10px 10px;
245 | border-style: solid;
246 | border-width: 0px 0px 0px 10px;
247 | border-color: #19f52d;
248 | }
249 |
250 | .times-div {
251 | text-align: center;
252 | padding: 5px;
253 | }
254 |
255 | .suite-total-time {
256 | font: 16px 'Lucida Grande';
257 | }
258 |
259 | .configuration-suite {
260 | margin-left: 20px;
261 | }
262 |
263 | .configuration-test {
264 | margin-left: 40px;
265 | }
266 |
267 | .configuration-class {
268 | margin-left: 60px;
269 | }
270 |
271 | .configuration-method {
272 | margin-left: 80px;
273 | }
274 |
275 | .test-method {
276 | margin-left: 100px;
277 | }
278 |
279 | .chronological-class {
280 | background-color: #0ccff;
281 | border-style: solid;
282 | border-width: 0px 0px 1px 1px;
283 | }
284 |
285 | .method-start {
286 | float: right;
287 | }
288 |
289 | .chronological-class-name {
290 | padding: 0px 0px 0px 5px;
291 | color: #008;
292 | }
293 |
294 | .after, .before, .test-method {
295 | font-family: monospace;
296 | font-size: 14px;
297 | }
298 |
299 | .navigator-suite-header {
300 | font-size: 22px;
301 | margin: 0px 10px 5px 0px;
302 | background-color: #deb887;
303 | text-align: center;
304 | }
305 |
306 | .collapse-all-icon {
307 | padding: 5px;
308 | float: right;
309 | }
310 |
--------------------------------------------------------------------------------
/target/surefire-reports/wiseoper/账号延期.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | TestNG: 账号延期
4 |
5 |
6 |
7 |
11 |
53 |
54 |
55 |
56 | 账号延期
57 |
58 | Tests passed/Failed/Skipped: 0/1/0
59 |
60 | Started on: Wed Jul 05 17:47:43 CST 2017
61 |
62 | Total time: 33 seconds (33118 ms)
63 |
64 | Included groups:
65 |
66 | Excluded groups:
67 |
68 |
69 | (Hover the method name to see the test class name)
70 |
71 | FAILED TESTS
72 | Test method
73 | Exception
74 | Time (seconds)
75 | Instance
76 |
77 |
78 | testApplyContinue Test class: test.ApplyContinueTest
79 | org.openqa.selenium.TimeoutException: Expected condition failed: waiting for presence of element located by: By.xpath: //*[@id="wiseoper-content"]/div[3]/div/div[1]/span[3] (tried for 10 second(s) with 500 MILLISECONDS interval)
80 | at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:80)
81 | at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:232)
82 | at util.OperateElement.waitForElement(OperateElement.java:99)
83 | at util.OperateElement.checkElement(OperateElement.java:43)
84 | at pageobjects.ApplyContinuePage.checkpoint(ApplyContinuePage.java:103)
85 | at test.ApplyContinueTest.testApplyContinue(ApplyContinueTest.java:32)
86 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
87 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
88 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
89 | at java.lang.Thread.run(Thread.java:745)
90 | Caused by: org.openqa.selenium.NoSuchElementException: Cannot locate an element using By.xpath: //*[@id="wiseoper-content"]/div[3]/div/div[1]/span[3]
91 | For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
92 | Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
93 | System info: host: '4CV65290DX', ip: '192.168.1.180', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'
94 | Driver info: driver.version: unknown
95 | at org.openqa.selenium.support.ui.ExpectedConditions.lambda$findElement$0(ExpectedConditions.java:883)
96 | at java.util.Optional.orElseThrow(Optional.java:290)
97 | at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:882)
98 | at org.openqa.selenium.support.ui.ExpectedConditions.access$000(ExpectedConditions.java:44)
99 | at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:183)
100 | at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:180)
101 | at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:209)
102 | ... 24 more
103 | ... Removed 16 stack frames Click to show all stack frames
104 | org.openqa.selenium.TimeoutException: Expected condition failed: waiting for presence of element located by: By.xpath: //*[@id="wiseoper-content"]/div[3]/div/div[1]/span[3] (tried for 10 second(s) with 500 MILLISECONDS interval)
105 | at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:80)
106 | at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:232)
107 | at util.OperateElement.waitForElement(OperateElement.java:99)
108 | at util.OperateElement.checkElement(OperateElement.java:43)
109 | at pageobjects.ApplyContinuePage.checkpoint(ApplyContinuePage.java:103)
110 | at test.ApplyContinueTest.testApplyContinue(ApplyContinueTest.java:32)
111 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
112 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
113 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
114 | at java.lang.reflect.Method.invoke(Method.java:498)
115 | at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
116 | at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
117 | at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
118 | at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
119 | at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
120 | at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
121 | at org.testng.TestRunner.privateRun(TestRunner.java:744)
122 | at org.testng.TestRunner.run(TestRunner.java:602)
123 | at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
124 | at org.testng.SuiteRunner.access$000(SuiteRunner.java:39)
125 | at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:414)
126 | at org.testng.internal.thread.ThreadUtil$1.call(ThreadUtil.java:52)
127 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
128 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
129 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
130 | at java.lang.Thread.run(Thread.java:745)
131 | Caused by: org.openqa.selenium.NoSuchElementException: Cannot locate an element using By.xpath: //*[@id="wiseoper-content"]/div[3]/div/div[1]/span[3]
132 | For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
133 | Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
134 | System info: host: '4CV65290DX', ip: '192.168.1.180', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'
135 | Driver info: driver.version: unknown
136 | at org.openqa.selenium.support.ui.ExpectedConditions.lambda$findElement$0(ExpectedConditions.java:883)
137 | at java.util.Optional.orElseThrow(Optional.java:290)
138 | at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:882)
139 | at org.openqa.selenium.support.ui.ExpectedConditions.access$000(ExpectedConditions.java:44)
140 | at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:183)
141 | at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:180)
142 | at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:209)
143 | ... 24 more
144 |
145 | 28
146 | test.ApplyContinueTest@5f3a4b84
147 |
148 |
149 |
--------------------------------------------------------------------------------