├── .gitignore ├── LICENSE ├── NOTICE ├── README.md ├── STFTestReport.png ├── mocktestng.xml ├── pom.xml ├── src ├── main │ ├── java │ │ └── com │ │ │ └── seleniumtests │ │ │ ├── browserfactory │ │ │ ├── AbstractWebDriverFactory.java │ │ │ ├── AndroidCapabilitiesFactory.java │ │ │ ├── AndroidDriverFactory.java │ │ │ ├── ChromeCapabilitiesFactory.java │ │ │ ├── ChromeDriverFactory.java │ │ │ ├── FirefoxCapabilitiesFactory.java │ │ │ ├── FirefoxDriverFactory.java │ │ │ ├── ICapabilitiesFactory.java │ │ │ ├── IECapabilitiesFactory.java │ │ │ ├── IEDriverFactory.java │ │ │ ├── IOsCapabilitiesFactory.java │ │ │ ├── IPhoneCapabilitiesFactory.java │ │ │ ├── IPhoneDriverFactory.java │ │ │ ├── IWebDriverFactory.java │ │ │ ├── RemoteDriverFactory.java │ │ │ ├── SafariCapabilitiesFactory.java │ │ │ ├── SafariDriverFactory.java │ │ │ ├── SauceLabsCapabilitiesFactory.java │ │ │ └── SauceLabsDriverFactory.java │ │ │ ├── core │ │ │ ├── CustomAssertion.java │ │ │ ├── CustomEventListener.java │ │ │ ├── DefaultTestNGContext.java │ │ │ ├── DefaultXmlSuite.java │ │ │ ├── Filter.java │ │ │ ├── IContextAttributeListener.java │ │ │ ├── Locator.java │ │ │ ├── SeleniumTestPlan.java │ │ │ ├── SeleniumTestsContext.java │ │ │ ├── SeleniumTestsContextManager.java │ │ │ ├── SeleniumTestsDefaultSuite.java │ │ │ ├── SeleniumTestsPageListener.java │ │ │ ├── TearDownService.java │ │ │ ├── TestLogging.java │ │ │ ├── TestRetryAnalyzer.java │ │ │ └── TestRetryListener.java │ │ │ ├── customFFprofile │ │ │ └── FireFoxProfileMarker.java │ │ │ ├── customexception │ │ │ ├── CustomSeleniumTestsException.java │ │ │ ├── DriverExceptions.java │ │ │ ├── NotCurrentPageException.java │ │ │ └── WebSessionEndedException.java │ │ │ ├── driver │ │ │ ├── BrowserType.java │ │ │ ├── CustomEventFiringWebDriver.java │ │ │ ├── DriverConfig.java │ │ │ ├── DriverExceptionListener.java │ │ │ ├── DriverMode.java │ │ │ ├── ScreenShot.java │ │ │ ├── ScreenShotRemoteWebDriver.java │ │ │ ├── ScreenshotUtil.java │ │ │ ├── TestType.java │ │ │ ├── WebUIDriver.java │ │ │ └── WebUtility.java │ │ │ ├── helper │ │ │ ├── ContextHelper.java │ │ │ ├── FileUtility.java │ │ │ ├── HashCodeGenerator.java │ │ │ ├── OSUtility.java │ │ │ ├── StringUtility.java │ │ │ ├── WaitHelper.java │ │ │ └── XMLUtility.java │ │ │ ├── reporter │ │ │ ├── ElaborateLog.java │ │ │ ├── PluginsHelper.java │ │ │ ├── SeleniumTestsReporter.java │ │ │ ├── ShortTestResult.java │ │ │ └── pluginmodel │ │ │ │ ├── Method.java │ │ │ │ ├── Page.java │ │ │ │ ├── Plugin.java │ │ │ │ ├── SeleniumTestsPlugins.java │ │ │ │ └── Test.java │ │ │ ├── resources │ │ │ └── WebDriverExternalResources.java │ │ │ ├── util │ │ │ ├── CSVHelper.java │ │ │ ├── SpreadSheetHelper.java │ │ │ └── internal │ │ │ │ └── entity │ │ │ │ └── TestEntity.java │ │ │ ├── webelements │ │ │ ├── BasePage.java │ │ │ ├── ButtonElement.java │ │ │ ├── CheckBoxElement.java │ │ │ ├── HtmlElement.java │ │ │ ├── IPage.java │ │ │ ├── ImageElement.java │ │ │ ├── LabelElement.java │ │ │ ├── LinkElement.java │ │ │ ├── PageObject.java │ │ │ ├── RadioButtonElement.java │ │ │ ├── SelectList.java │ │ │ ├── Table.java │ │ │ ├── TextFieldElement.java │ │ │ └── WebPageSection.java │ │ │ └── xmldog │ │ │ ├── Comparator.java │ │ │ ├── Config.java │ │ │ ├── Difference.java │ │ │ ├── DifferenceConstants.java │ │ │ ├── DifferenceListener.java │ │ │ ├── Differences.java │ │ │ ├── FileUtil.java │ │ │ ├── MOVMap.java │ │ │ ├── NodeDescription.java │ │ │ ├── NodeDetail.java │ │ │ ├── NodeResult.java │ │ │ ├── OrderedMap.java │ │ │ ├── StringUtil.java │ │ │ ├── XMLConstants.java │ │ │ ├── XMLDog.java │ │ │ ├── XMLDogConstants.java │ │ │ ├── XMLUtil.java │ │ │ └── XNode.java │ └── resources │ │ ├── reporter │ │ ├── css │ │ │ ├── jquery.lightbox-0.5.css │ │ │ ├── mktree.css │ │ │ └── report.css │ │ ├── images │ │ │ ├── lightbox │ │ │ │ ├── seleniumtests_lightbox-blank.gif │ │ │ │ ├── seleniumtests_lightbox-btn-close.gif │ │ │ │ ├── seleniumtests_lightbox-btn-next.gif │ │ │ │ ├── seleniumtests_lightbox-btn-prev.gif │ │ │ │ └── seleniumtests_lightbox-ico-loading.gif │ │ │ ├── mktree │ │ │ │ ├── ff.gif │ │ │ │ ├── ffgrey.gif │ │ │ │ ├── firefox16.gif │ │ │ │ ├── imgLoading_sm.gif │ │ │ │ ├── loadeing_esm.gif │ │ │ │ ├── loading.gif │ │ │ │ ├── loading_sm_non.GIF │ │ │ │ ├── loading_smgif.gif │ │ │ │ ├── passed_sm.gif │ │ │ │ ├── selenium-grid-logo.png │ │ │ │ ├── seleniumtests_bullet.gif │ │ │ │ ├── seleniumtests_failed_sm.gif │ │ │ │ ├── seleniumtests_minus.gif │ │ │ │ ├── seleniumtests_plus.gif │ │ │ │ ├── seleniumtests_test1.gif │ │ │ │ ├── seleniumtests_test2.gif │ │ │ │ ├── seleniumtests_test3.gif │ │ │ │ ├── skipped.gif │ │ │ │ ├── testng.gif │ │ │ │ └── wait16.gif │ │ │ └── yukontoolbox │ │ │ │ ├── seleniumtests_footer_grad.gif │ │ │ │ ├── seleniumtests_grey_bl.gif │ │ │ │ ├── seleniumtests_grey_br.gif │ │ │ │ ├── seleniumtests_hovertab_l.gif │ │ │ │ ├── seleniumtests_hovertab_r.gif │ │ │ │ ├── seleniumtests_tabbed_nav_goldgradbg.png │ │ │ │ ├── seleniumtests_table_sep_left.gif │ │ │ │ ├── seleniumtests_table_sep_right.gif │ │ │ │ ├── seleniumtests_table_zebrastripe_left.gif │ │ │ │ ├── seleniumtests_table_zebrastripe_right.gif │ │ │ │ └── seleniumtests_yellow_tr.gif │ │ └── js │ │ │ ├── browserdetect.js │ │ │ ├── jquery-1.10.2.min.js │ │ │ ├── jquery.lightbox-0.5.min.js │ │ │ ├── mktree.js │ │ │ └── report.js │ │ └── templates │ │ ├── report.part.header.html │ │ ├── report.part.singlePageError.html │ │ ├── report.part.singleTest.html │ │ ├── report.part.summary.html │ │ ├── report.part.testDetail.html │ │ └── screenshotHTMLPage.html └── test │ ├── java │ └── com │ │ └── seleniumtests │ │ ├── dataobject │ │ └── User.java │ │ ├── tests │ │ ├── AndroidAppTest.java │ │ ├── AndroidWebTest.java │ │ ├── IOSAppTest.java │ │ ├── JSErrorTest.java │ │ ├── RegistrationTest.java │ │ ├── RetryTest.java │ │ ├── RetryTest1.java │ │ ├── RetryTest2.java │ │ ├── RetryTest3.java │ │ ├── SauceLabsTest.java │ │ └── SoftAssertionTest.java │ │ └── webpage │ │ ├── CalculatorScreen.java │ │ ├── GoogleHomePage.java │ │ ├── JSErrorPage.java │ │ ├── LoginPage.java │ │ ├── RegistrationPage.java │ │ ├── SauceLabsPage.java │ │ └── UICatalogScreen.java │ └── resources │ ├── com │ └── seleniumtests │ │ └── tests │ │ └── loginuser.csv │ └── profiles │ └── customProfileDirCUSTFF │ ├── cert8.db │ ├── cert_override.txt │ ├── extensions │ ├── readystate@openqa.org │ │ ├── chrome.manifest │ │ ├── chrome │ │ │ └── readystate.jar │ │ └── install.rdf │ ├── {3d7eb24f-2740-49df-8937-200b1cc08f8a} │ │ ├── chrome.manifest │ │ ├── chrome │ │ │ └── flashblock.jar │ │ ├── defaults │ │ │ └── preferences │ │ │ │ └── flashblock.js │ │ └── install.rdf │ ├── {503A0CD4-EDC8-489b-853B-19E0BAA8F0A4} │ │ ├── chrome.manifest │ │ └── install.rdf │ └── {538F0036-F358-4f84-A764-89FB437166B4} │ │ ├── chrome.manifest │ │ ├── install.rdf │ │ └── kill.html │ └── mimeTypes.rdf └── testng.xml /.gitignore: -------------------------------------------------------------------------------- 1 | test-output/ 2 | target/ 3 | build/ 4 | bin/ 5 | *.jar 6 | .project 7 | .classpath 8 | chromedriver.log 9 | .idea/ 10 | .settings/ 11 | velocity.log 12 | seleniumtestsframework.iml -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2014-2021 www.seleniumtests.com 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SeleniumTestsFramework 2 | 3 | ## Introduction 4 | Selenium Tests Framework (referred as STF from here on) is a test automation framework for automated testing of Desktop web, mobile site and mobile apps. STF is based on WebDriver, Appium, TestNG and Maven. 5 | 6 | * [STF Features](http://www.seleniumtests.com/2013/10/announcing-selenium-tests-automation.html) 7 | 8 | * [Awesome STF Reporting](http://www.seleniumtests.com/2013/12/stf-test-report-snapshots.html) 9 | 10 | * [5 minutes guide](http://www.seleniumtests.com/2013/12/5-minutes-guides-to-using-selenium.html) 11 | 12 | * [Installing STF](http://www.seleniumtests.com/2013/10/installing-selenium-tests-framework.html) 13 | 14 | * [Parameters used in STF](http://www.seleniumtests.com/2014/04/parameters-used-in-selenium-tests-framework.html) 15 | 16 | * [How to setup your own cutom driver](http://www.seleniumtests.com/2013/01/set-up-driver-in-selenium-tests.html) 17 | 18 | * [STF and mobile device automation](http://www.seleniumtests.com/2015/07/stf-and-android-test-automation.html) 19 | 20 | ## Is there a test project which uses STF? 21 | If you are looking for a sample project which uses STF then you should clone [seleniumtests](https://github.com/TestingForum/seleniumtests) project and not this project. [seleniumtests](https://github.com/TestingForum/seleniumtests) uses STF and demonstrates its features. 22 | 23 | ## I have a question 24 | Have a question or feature request? Post it under comment section of [STF Features](http://www.seleniumtests.com/2013/10/announcing-selenium-tests-automation.html) 25 | 26 | ## I want to contribute 27 | Clone the project and submit pull request :) 28 | -------------------------------------------------------------------------------- /STFTestReport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/STFTestReport.png -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/AbstractWebDriverFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import java.util.concurrent.TimeUnit; 17 | 18 | import org.openqa.selenium.WebDriver; 19 | import org.openqa.selenium.WebDriverException; 20 | 21 | import com.seleniumtests.core.TestLogging; 22 | import com.seleniumtests.driver.DriverConfig; 23 | import com.seleniumtests.driver.WebUIDriver; 24 | 25 | public abstract class AbstractWebDriverFactory { 26 | 27 | protected DriverConfig webDriverConfig; 28 | 29 | protected WebDriver driver; 30 | 31 | public AbstractWebDriverFactory(final DriverConfig cfg) { 32 | this.webDriverConfig = cfg; 33 | } 34 | 35 | public void cleanUp() { 36 | try { 37 | if (driver != null) { 38 | try { 39 | TestLogging.log("quiting webdriver" + Thread.currentThread().getId()); 40 | driver.quit(); 41 | } catch (WebDriverException ex) { 42 | TestLogging.log("Exception encountered when quiting driver: " 43 | + WebUIDriver.getWebUIDriver().getConfig().getBrowser().name() + ":" + ex.getMessage()); 44 | } 45 | 46 | driver = null; 47 | } 48 | } catch (Exception e) { 49 | e.printStackTrace(); 50 | } 51 | } 52 | 53 | public WebDriver createWebDriver() throws Exception { 54 | return null; 55 | } 56 | 57 | /** 58 | * Accessed by sub classes so that they don't have be declared abstract class. 59 | * 60 | * @return driver instance 61 | */ 62 | public WebDriver getWebDriver() { 63 | return driver; 64 | } 65 | 66 | public DriverConfig getWebDriverConfig() { 67 | return webDriverConfig; 68 | } 69 | 70 | public void setImplicitWaitTimeout(final double timeout) { 71 | if (timeout < 1) { 72 | driver.manage().timeouts().implicitlyWait((long) (timeout * 1000), TimeUnit.MILLISECONDS); 73 | } else { 74 | try { 75 | driver.manage().timeouts().implicitlyWait(new Double(timeout).intValue(), TimeUnit.SECONDS); 76 | } catch (Exception ex) { 77 | ex.printStackTrace(); 78 | } 79 | } 80 | } 81 | 82 | public void setWebDriver(final WebDriver driver) { 83 | this.driver = driver; 84 | } 85 | 86 | public void setWebDriverConfig(final DriverConfig cfg) { 87 | this.webDriverConfig = cfg; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/AndroidCapabilitiesFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import org.openqa.selenium.remote.CapabilityType; 17 | import org.openqa.selenium.remote.DesiredCapabilities; 18 | 19 | import com.seleniumtests.driver.DriverConfig; 20 | 21 | /** 22 | * Sets Android capabilities. 23 | */ 24 | public class AndroidCapabilitiesFactory implements ICapabilitiesFactory { 25 | 26 | public DesiredCapabilities createCapabilities(final DriverConfig cfg) { 27 | DesiredCapabilities capabilities = new DesiredCapabilities(); 28 | 29 | capabilities.setCapability("automationName", cfg.getAutomationName()); 30 | capabilities.setCapability("platformName", cfg.getMobilePlatformName()); 31 | 32 | // Set up version and device name else appium server would pick the only available emulator/device 33 | // Both of these are ignored for android for now 34 | capabilities.setCapability("platformVersion", cfg.getMobilePlatformVersion()); 35 | capabilities.setCapability("deviceName", cfg.getDeviceName()); 36 | 37 | capabilities.setCapability("app", cfg.getApp()); 38 | capabilities.setCapability("appPackage", cfg.getAppPackage()); 39 | capabilities.setCapability("appActivity", cfg.getAppActivity()); 40 | 41 | capabilities.setCapability(CapabilityType.BROWSER_NAME, cfg.getBrowserName()); 42 | capabilities.setCapability("newCommandTimeout", cfg.getNewCommandTimeout()); 43 | 44 | return capabilities; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/AndroidDriverFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import java.io.IOException; 17 | import java.net.MalformedURLException; 18 | import java.net.URL; 19 | import java.util.concurrent.TimeUnit; 20 | 21 | import org.openqa.selenium.UnsupportedCommandException; 22 | import org.openqa.selenium.WebDriver; 23 | 24 | import com.seleniumtests.driver.DriverConfig; 25 | import io.appium.java_client.android.AndroidDriver; 26 | 27 | /** 28 | * AndroidDriverFactory. 29 | */ 30 | public class AndroidDriverFactory extends AbstractWebDriverFactory implements IWebDriverFactory { 31 | 32 | public AndroidDriverFactory(final DriverConfig webDriverConfig) { 33 | super(webDriverConfig); 34 | } 35 | 36 | protected WebDriver createNativeDriver() throws MalformedURLException { 37 | 38 | return new AndroidDriver(new URL(webDriverConfig.getAppiumServerURL()), new AndroidCapabilitiesFactory() 39 | .createCapabilities(webDriverConfig)); 40 | } 41 | 42 | @Override 43 | public WebDriver createWebDriver() throws IOException { 44 | DriverConfig cfg = this.getWebDriverConfig(); 45 | 46 | driver = createNativeDriver(); 47 | 48 | setImplicitWaitTimeout(cfg.getImplicitWaitTimeout()); 49 | if (cfg.getPageLoadTimeout() >= 0) { 50 | setPageLoadTimeout(cfg.getPageLoadTimeout()); 51 | } 52 | 53 | this.setWebDriver(driver); 54 | return driver; 55 | } 56 | 57 | protected void setPageLoadTimeout(final long timeout) { 58 | try { 59 | driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS); 60 | } catch (UnsupportedCommandException e) { 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/ChromeCapabilitiesFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import org.openqa.selenium.Proxy; 17 | import org.openqa.selenium.chrome.ChromeOptions; 18 | import org.openqa.selenium.remote.CapabilityType; 19 | import org.openqa.selenium.remote.DesiredCapabilities; 20 | 21 | import com.seleniumtests.driver.DriverConfig; 22 | import com.seleniumtests.driver.DriverMode; 23 | 24 | public class ChromeCapabilitiesFactory implements ICapabilitiesFactory { 25 | 26 | public DesiredCapabilities createCapabilities(final DriverConfig webDriverConfig) { 27 | 28 | DesiredCapabilities capability = null; 29 | capability = DesiredCapabilities.chrome(); 30 | capability.setBrowserName(DesiredCapabilities.chrome().getBrowserName()); 31 | 32 | ChromeOptions options = new ChromeOptions(); 33 | if (webDriverConfig.getUserAgentOverride() != null) { 34 | options.addArguments("--user-agent=" + webDriverConfig.getUserAgentOverride()); 35 | } 36 | 37 | capability.setCapability(ChromeOptions.CAPABILITY, options); 38 | 39 | if (webDriverConfig.isEnableJavascript()) { 40 | capability.setJavascriptEnabled(true); 41 | } else { 42 | capability.setJavascriptEnabled(false); 43 | } 44 | 45 | capability.setCapability(CapabilityType.TAKES_SCREENSHOT, true); 46 | capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); 47 | 48 | if (webDriverConfig.getBrowserVersion() != null) { 49 | capability.setVersion(webDriverConfig.getBrowserVersion()); 50 | } 51 | 52 | if (webDriverConfig.getWebPlatform() != null) { 53 | capability.setPlatform(webDriverConfig.getWebPlatform()); 54 | } 55 | 56 | if (webDriverConfig.getProxyHost() != null) { 57 | Proxy proxy = webDriverConfig.getProxy(); 58 | capability.setCapability(CapabilityType.PROXY, proxy); 59 | } 60 | 61 | if (webDriverConfig.getChromeBinPath() != null) { 62 | capability.setCapability("chrome.binary", webDriverConfig.getChromeBinPath()); 63 | } 64 | 65 | // Set ChromeDriver for local mode 66 | if (webDriverConfig.getMode() == DriverMode.LOCAL) { 67 | } 68 | 69 | return capability; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/ChromeDriverFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import java.io.IOException; 17 | import java.util.concurrent.TimeUnit; 18 | 19 | import org.openqa.selenium.UnsupportedCommandException; 20 | import org.openqa.selenium.WebDriver; 21 | import org.openqa.selenium.chrome.ChromeDriver; 22 | 23 | import com.seleniumtests.driver.DriverConfig; 24 | import io.github.bonigarcia.wdm.WebDriverManager; 25 | 26 | public class ChromeDriverFactory extends AbstractWebDriverFactory implements IWebDriverFactory { 27 | 28 | public ChromeDriverFactory(final DriverConfig cfg) { 29 | super(cfg); 30 | } 31 | 32 | protected WebDriver createNativeDriver() { 33 | WebDriverManager.chromedriver().setup(); 34 | return new ChromeDriver(new ChromeCapabilitiesFactory().createCapabilities(webDriverConfig)); 35 | } 36 | 37 | @Override 38 | public WebDriver createWebDriver() throws IOException { 39 | DriverConfig cfg = this.getWebDriverConfig(); 40 | 41 | driver = createNativeDriver(); 42 | 43 | setImplicitWaitTimeout(cfg.getImplicitWaitTimeout()); 44 | if (cfg.getPageLoadTimeout() >= 0) { 45 | setPageLoadTimeout(cfg.getPageLoadTimeout()); 46 | } 47 | 48 | this.setWebDriver(driver); 49 | return driver; 50 | } 51 | 52 | protected void setPageLoadTimeout(final long timeout) { 53 | try { 54 | driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS); 55 | } catch (UnsupportedCommandException e) { } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/FirefoxDriverFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import java.util.concurrent.TimeUnit; 17 | 18 | import org.openqa.selenium.WebDriver; 19 | import org.openqa.selenium.WebDriverException; 20 | import org.openqa.selenium.firefox.FirefoxDriver; 21 | 22 | import com.seleniumtests.driver.DriverConfig; 23 | import io.github.bonigarcia.wdm.WebDriverManager; 24 | 25 | public class FirefoxDriverFactory extends AbstractWebDriverFactory implements IWebDriverFactory { 26 | private long timeout = 60; 27 | 28 | /** 29 | * @param cfg the configuration of the firefoxDriver 30 | */ 31 | public FirefoxDriverFactory(final DriverConfig cfg) { 32 | super(cfg); 33 | } 34 | 35 | /** 36 | * create native driver instance, designed for unit testing. 37 | * 38 | * @return 39 | */ 40 | protected WebDriver createNativeDriver() { 41 | WebDriverManager.firefoxdriver().setup(); 42 | return new FirefoxDriver(new FirefoxCapabilitiesFactory().createCapabilities(webDriverConfig)); 43 | } 44 | 45 | @Override 46 | public WebDriver createWebDriver() { 47 | DriverConfig cfg = this.getWebDriverConfig(); 48 | 49 | System.out.println("start create firefox"); 50 | driver = createWebDriverWithTimeout(); 51 | 52 | System.out.println("end create firefox"); 53 | 54 | // Implicit Waits to handle dynamic element. The default value is 5 55 | // seconds. 56 | setImplicitWaitTimeout(cfg.getImplicitWaitTimeout()); 57 | if (cfg.getPageLoadTimeout() >= 0) { 58 | setPageLoadTimeout(cfg.getPageLoadTimeout()); 59 | } 60 | 61 | this.setWebDriver(driver); 62 | return driver; 63 | } 64 | 65 | /** 66 | * Create webDriver, capture socket customexception and retry with timeout. 67 | * 68 | * @return WebDriver 69 | */ 70 | protected WebDriver createWebDriverWithTimeout() { 71 | long time = 0; 72 | while (time < getTimeout()) { 73 | try { 74 | driver = createNativeDriver(); 75 | return driver; 76 | } catch (WebDriverException ex) { 77 | if (ex.getMessage().contains("SocketException") 78 | || ex.getMessage().contains("Failed to connect to binary FirefoxBinary") 79 | || ex.getMessage().contains("Unable to bind to locking port 7054 within 45000 ms")) { 80 | try { 81 | Thread.sleep(1000); 82 | } catch (InterruptedException e) { } 83 | 84 | time++; 85 | } else { 86 | throw new RuntimeException(ex); 87 | } 88 | } 89 | } 90 | 91 | throw new RuntimeException("Got customexception when creating webDriver with socket timeout 1 minute"); 92 | } 93 | 94 | /** 95 | * It's designed for shorten tiemout in unit testing. 96 | * 97 | * @return timeout 98 | */ 99 | protected long getTimeout() { 100 | return timeout; 101 | } 102 | 103 | protected void setPageLoadTimeout(final long timeout) { 104 | driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/ICapabilitiesFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import org.openqa.selenium.remote.DesiredCapabilities; 17 | 18 | import com.seleniumtests.driver.DriverConfig; 19 | 20 | public interface ICapabilitiesFactory { 21 | 22 | DesiredCapabilities createCapabilities(DriverConfig cfg); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/IECapabilitiesFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import java.io.File; 17 | import java.io.IOException; 18 | 19 | import org.openqa.selenium.Proxy; 20 | import org.openqa.selenium.ie.InternetExplorerDriver; 21 | import org.openqa.selenium.remote.CapabilityType; 22 | import org.openqa.selenium.remote.DesiredCapabilities; 23 | 24 | import com.seleniumtests.driver.DriverConfig; 25 | import com.seleniumtests.driver.DriverMode; 26 | import com.seleniumtests.helper.FileUtility; 27 | import com.seleniumtests.resources.WebDriverExternalResources; 28 | 29 | public class IECapabilitiesFactory implements ICapabilitiesFactory { 30 | 31 | private void handleExtractResources() throws IOException { 32 | String dir = this.getClass().getResource("/").getPath(); 33 | dir = FileUtility.decodePath(dir); 34 | if (!new File(dir).exists()) { 35 | FileUtility.extractJar(dir, WebDriverExternalResources.class); 36 | } 37 | } 38 | 39 | public DesiredCapabilities createCapabilities(final DriverConfig cfg) { 40 | 41 | // Set IEDriver for Local Mode 42 | if (cfg.getMode() == DriverMode.LOCAL) { 43 | // Do nothing as WebDriverManager takes care of driver set up 44 | 45 | } 46 | 47 | DesiredCapabilities capability = DesiredCapabilities.internetExplorer(); 48 | 49 | capability.setBrowserName(DesiredCapabilities.internetExplorer().getBrowserName()); 50 | 51 | if (cfg.isEnableJavascript()) { 52 | capability.setJavascriptEnabled(true); 53 | } else { 54 | capability.setJavascriptEnabled(false); 55 | } 56 | 57 | capability.setCapability(CapabilityType.TAKES_SCREENSHOT, true); 58 | capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); 59 | capability.setCapability("ignoreZoomSetting", true); 60 | 61 | if (cfg.getBrowserVersion() != null) { 62 | capability.setVersion(cfg.getBrowserVersion()); 63 | } 64 | 65 | if (cfg.getWebPlatform() != null) { 66 | capability.setPlatform(cfg.getWebPlatform()); 67 | } 68 | 69 | if (cfg.getProxyHost() != null) { 70 | Proxy proxy = cfg.getProxy(); 71 | capability.setCapability(CapabilityType.PROXY, proxy); 72 | } 73 | 74 | capability.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); 75 | return capability; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/IEDriverFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import java.io.IOException; 17 | import java.util.concurrent.TimeUnit; 18 | 19 | import org.openqa.selenium.WebDriver; 20 | import org.openqa.selenium.WebDriverException; 21 | import org.openqa.selenium.ie.InternetExplorerDriver; 22 | 23 | import com.seleniumtests.driver.DriverConfig; 24 | import com.seleniumtests.helper.OSUtility; 25 | import io.github.bonigarcia.wdm.WebDriverManager; 26 | 27 | public class IEDriverFactory extends AbstractWebDriverFactory implements IWebDriverFactory { 28 | 29 | public IEDriverFactory(final DriverConfig webDriverConfig1) { 30 | super(webDriverConfig1); 31 | } 32 | 33 | @Override 34 | public void cleanUp() { 35 | try { 36 | if (driver != null) { 37 | try { 38 | driver.quit(); 39 | } catch (WebDriverException ex) { 40 | ex.printStackTrace(); 41 | } 42 | 43 | driver = null; 44 | } 45 | } catch (Exception e) { 46 | e.printStackTrace(); 47 | } 48 | } 49 | 50 | @Override 51 | public WebDriver createWebDriver() throws IOException { 52 | 53 | // killProcess(); 54 | if (!OSUtility.isWindows()) { 55 | throw new RuntimeException("With gods grace IE browser is only supported on windows, Imagine a " 56 | + "situation when you have to fix IE bugs on Unix and Mac as well"); 57 | } 58 | 59 | DriverConfig cfg = this.getWebDriverConfig(); 60 | WebDriverManager.iedriver().setup(); 61 | driver = new InternetExplorerDriver(new IECapabilitiesFactory().createCapabilities(cfg)); 62 | 63 | // Implicit Waits to handle dynamic element. The default value is 5 seconds. 64 | setImplicitWaitTimeout(cfg.getImplicitWaitTimeout()); 65 | if (cfg.getPageLoadTimeout() >= 0) { 66 | driver.manage().timeouts().pageLoadTimeout(cfg.getPageLoadTimeout(), TimeUnit.SECONDS); 67 | } 68 | 69 | this.setWebDriver(driver); 70 | return driver; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/IOsCapabilitiesFactory.java: -------------------------------------------------------------------------------- 1 | package com.seleniumtests.browserfactory; 2 | 3 | import com.seleniumtests.driver.DriverConfig; 4 | import org.openqa.selenium.remote.CapabilityType; 5 | import org.openqa.selenium.remote.DesiredCapabilities; 6 | 7 | public class IOsCapabilitiesFactory implements ICapabilitiesFactory { 8 | 9 | public DesiredCapabilities createCapabilities(final DriverConfig cfg) { 10 | final DesiredCapabilities capabilities = new DesiredCapabilities(); 11 | 12 | capabilities.setCapability("automationName", cfg.getAutomationName()); 13 | capabilities.setCapability("platformName", cfg.getMobilePlatformName()); 14 | 15 | // Set up version and device name else appium server would pick the only available emulator/device 16 | // Both of these are ignored for android for now 17 | capabilities.setCapability("platformVersion", cfg.getMobilePlatformVersion()); 18 | capabilities.setCapability("deviceName", cfg.getDeviceName()); 19 | 20 | capabilities.setCapability("app", cfg.getApp()); 21 | capabilities.setCapability("appPackage", cfg.getAppPackage()); 22 | capabilities.setCapability("appActivity", cfg.getAppActivity()); 23 | 24 | capabilities.setCapability(CapabilityType.BROWSER_NAME, cfg.getBrowserName()); 25 | capabilities.setCapability("newCommandTimeout", cfg.getNewCommandTimeout()); 26 | 27 | return capabilities; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/IPhoneCapabilitiesFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import org.openqa.selenium.remote.CapabilityType; 17 | import org.openqa.selenium.remote.DesiredCapabilities; 18 | 19 | import com.seleniumtests.driver.DriverConfig; 20 | 21 | /** 22 | * Sets iphone capabilities. 23 | */ 24 | public class IPhoneCapabilitiesFactory implements ICapabilitiesFactory { 25 | 26 | public DesiredCapabilities createCapabilities(final DriverConfig cfg) { 27 | DesiredCapabilities capabilities = new DesiredCapabilities(); 28 | 29 | capabilities.setCapability("automationName", cfg.getAutomationName()); 30 | capabilities.setCapability("platformName", cfg.getMobilePlatformName()); 31 | 32 | // Set up version and device name else appium server would pick the only available emulator/device 33 | // Both of these are ignored for android for now 34 | capabilities.setCapability("platformVersion", cfg.getMobilePlatformVersion()); 35 | capabilities.setCapability("deviceName", cfg.getDeviceName()); 36 | 37 | capabilities.setCapability("app", cfg.getApp()); 38 | capabilities.setCapability("appPackage", cfg.getAppPackage()); 39 | capabilities.setCapability("appActivity", cfg.getAppActivity()); 40 | 41 | capabilities.setCapability(CapabilityType.BROWSER_NAME, cfg.getBrowserName()); 42 | capabilities.setCapability("newCommandTimeout", cfg.getNewCommandTimeout()); 43 | 44 | return capabilities; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/IPhoneDriverFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import java.io.IOException; 17 | import java.net.MalformedURLException; 18 | import java.net.URL; 19 | import java.util.concurrent.TimeUnit; 20 | 21 | import org.openqa.selenium.UnsupportedCommandException; 22 | import org.openqa.selenium.WebDriver; 23 | 24 | import com.seleniumtests.driver.DriverConfig; 25 | import io.appium.java_client.ios.IOSDriver; 26 | 27 | /** 28 | * IPhone Driver Factory 29 | */ 30 | public class IPhoneDriverFactory extends AbstractWebDriverFactory implements IWebDriverFactory { 31 | 32 | public IPhoneDriverFactory(final DriverConfig webDriverConfig) { 33 | super(webDriverConfig); 34 | } 35 | 36 | protected WebDriver createNativeDriver() throws MalformedURLException { 37 | 38 | return new IOSDriver(new URL(webDriverConfig.getAppiumServerURL()), new IPhoneCapabilitiesFactory() 39 | .createCapabilities(webDriverConfig)); 40 | } 41 | 42 | @Override 43 | public WebDriver createWebDriver() throws IOException { 44 | DriverConfig cfg = this.getWebDriverConfig(); 45 | 46 | driver = createNativeDriver(); 47 | 48 | setImplicitWaitTimeout(cfg.getImplicitWaitTimeout()); 49 | if (cfg.getPageLoadTimeout() >= 0) { 50 | setPageLoadTimeout(cfg.getPageLoadTimeout()); 51 | } 52 | 53 | this.setWebDriver(driver); 54 | return driver; 55 | } 56 | 57 | protected void setPageLoadTimeout(final long timeout) { 58 | try { 59 | driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS); 60 | } catch (UnsupportedCommandException e) { 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/IWebDriverFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import org.openqa.selenium.WebDriver; 17 | 18 | import com.seleniumtests.driver.DriverConfig; 19 | 20 | public interface IWebDriverFactory { 21 | 22 | void cleanUp(); 23 | 24 | WebDriver createWebDriver() throws Exception; 25 | 26 | WebDriver getWebDriver(); 27 | 28 | DriverConfig getWebDriverConfig(); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/SafariCapabilitiesFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import org.openqa.selenium.Proxy; 17 | import org.openqa.selenium.remote.CapabilityType; 18 | import org.openqa.selenium.remote.DesiredCapabilities; 19 | 20 | import com.seleniumtests.driver.DriverConfig; 21 | 22 | public class SafariCapabilitiesFactory implements ICapabilitiesFactory { 23 | 24 | public DesiredCapabilities createCapabilities(final DriverConfig cfg) { 25 | DesiredCapabilities capability = null; 26 | capability = DesiredCapabilities.safari(); 27 | 28 | if (cfg.isEnableJavascript()) { 29 | capability.setJavascriptEnabled(true); 30 | } else { 31 | capability.setJavascriptEnabled(false); 32 | } 33 | 34 | capability.setCapability(CapabilityType.TAKES_SCREENSHOT, true); 35 | capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); 36 | 37 | if (cfg.getBrowserVersion() != null) { 38 | capability.setVersion(cfg.getBrowserVersion()); 39 | } 40 | 41 | if (cfg.getWebPlatform() != null) { 42 | capability.setPlatform(cfg.getWebPlatform()); 43 | } 44 | 45 | if (cfg.getProxyHost() != null) { 46 | Proxy proxy = cfg.getProxy(); 47 | capability.setCapability(CapabilityType.PROXY, proxy); 48 | } 49 | 50 | return capability; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/SafariDriverFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.browserfactory; 15 | 16 | import org.openqa.selenium.WebDriver; 17 | import org.openqa.selenium.remote.DesiredCapabilities; 18 | import org.openqa.selenium.safari.SafariDriver; 19 | 20 | import com.seleniumtests.core.TestLogging; 21 | import com.seleniumtests.driver.DriverConfig; 22 | 23 | public class SafariDriverFactory extends AbstractWebDriverFactory implements IWebDriverFactory { 24 | 25 | public SafariDriverFactory(final DriverConfig cfg) { 26 | super(cfg); 27 | } 28 | 29 | @Override 30 | public WebDriver createWebDriver() { 31 | DesiredCapabilities cap = new SafariCapabilitiesFactory().createCapabilities(webDriverConfig); 32 | System.out.println("Begin Safari"); 33 | synchronized (this.getClass()) { 34 | driver = new SafariDriver(cap); 35 | } 36 | 37 | System.out.println("safari started"); 38 | 39 | this.setWebDriver(driver); 40 | 41 | // Implicit Waits handles dynamic element. 42 | setImplicitWaitTimeout(webDriverConfig.getImplicitWaitTimeout()); 43 | if (webDriverConfig.getPageLoadTimeout() >= 0) { 44 | TestLogging.log("Safari doesn't support pageLoadTimeout"); 45 | } 46 | 47 | return driver; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/SauceLabsCapabilitiesFactory.java: -------------------------------------------------------------------------------- 1 | package com.seleniumtests.browserfactory; 2 | 3 | import com.seleniumtests.core.SeleniumTestsContext; 4 | import com.seleniumtests.core.SeleniumTestsContextManager; 5 | import com.seleniumtests.driver.DriverConfig; 6 | import org.openqa.selenium.remote.DesiredCapabilities; 7 | 8 | public class SauceLabsCapabilitiesFactory implements ICapabilitiesFactory { 9 | @Override 10 | public DesiredCapabilities createCapabilities(final DriverConfig cfg) { 11 | 12 | final DesiredCapabilities capabilities = new DesiredCapabilities(); 13 | 14 | capabilities.setCapability("browserName", cfg.getBrowserName()); 15 | capabilities.setCapability("platform", cfg.getPlatform()); 16 | capabilities.setCapability("version", cfg.getVersion()); 17 | capabilities.setCapability("name", 18 | SeleniumTestsContextManager.getThreadContext().getAttribute(SeleniumTestsContext.TEST_METHOD_SIGNATURE)); 19 | 20 | return capabilities; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/browserfactory/SauceLabsDriverFactory.java: -------------------------------------------------------------------------------- 1 | package com.seleniumtests.browserfactory; 2 | 3 | import com.seleniumtests.customexception.DriverExceptions; 4 | import com.seleniumtests.driver.DriverConfig; 5 | import com.seleniumtests.driver.TestType; 6 | import io.appium.java_client.android.AndroidDriver; 7 | import io.appium.java_client.ios.IOSDriver; 8 | import org.openqa.selenium.UnsupportedCommandException; 9 | import org.openqa.selenium.WebDriver; 10 | import org.openqa.selenium.remote.RemoteWebDriver; 11 | 12 | import java.io.IOException; 13 | import java.net.MalformedURLException; 14 | import java.net.URL; 15 | import java.util.concurrent.TimeUnit; 16 | 17 | public class SauceLabsDriverFactory extends AbstractWebDriverFactory implements IWebDriverFactory { 18 | 19 | 20 | public SauceLabsDriverFactory(final DriverConfig cfg) { 21 | super(cfg); 22 | } 23 | 24 | protected WebDriver createNativeDriver() throws MalformedURLException { 25 | 26 | if(webDriverConfig.getTestType().equals(TestType.APPIUM_WEB_ANDROID.getTestType())){ 27 | return new AndroidDriver(new URL(webDriverConfig.getSauceLabsURL()), new AndroidCapabilitiesFactory() 28 | .createCapabilities(webDriverConfig)); 29 | } else if (webDriverConfig.getTestType().equals(TestType.APPIUM_WEB_IOS.getTestType())){ 30 | return new IOSDriver(new URL(webDriverConfig.getSauceLabsURL()), new IOsCapabilitiesFactory() 31 | .createCapabilities(webDriverConfig)); 32 | } 33 | 34 | return new RemoteWebDriver(new URL(webDriverConfig.getSauceLabsURL()), new SauceLabsCapabilitiesFactory() 35 | .createCapabilities(webDriverConfig)); 36 | 37 | } 38 | 39 | @Override 40 | public WebDriver createWebDriver() { 41 | final DriverConfig cfg = this.getWebDriverConfig(); 42 | 43 | try { 44 | driver = createNativeDriver(); 45 | } catch (final MalformedURLException me){ 46 | throw new DriverExceptions("Problem with creating driver", me); 47 | } 48 | 49 | setImplicitWaitTimeout(cfg.getImplicitWaitTimeout()); 50 | if (cfg.getPageLoadTimeout() >= 0) { 51 | setPageLoadTimeout(cfg.getPageLoadTimeout()); 52 | } 53 | 54 | this.setWebDriver(driver); 55 | return driver; 56 | } 57 | 58 | protected void setPageLoadTimeout(final long timeout) { 59 | try { 60 | driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS); 61 | } catch (UnsupportedCommandException e) { 62 | // chromedriver does not support pageLoadTimeout 63 | } 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/core/CustomEventListener.java: -------------------------------------------------------------------------------- 1 | package com.seleniumtests.core; 2 | 3 | import com.seleniumtests.webelements.HtmlElement; 4 | import org.openqa.selenium.WebDriver; 5 | import org.openqa.selenium.WebElement; 6 | import org.openqa.selenium.logging.LogEntries; 7 | import org.openqa.selenium.logging.LogEntry; 8 | import org.openqa.selenium.logging.LogType; 9 | import org.openqa.selenium.support.events.AbstractWebDriverEventListener; 10 | 11 | import java.util.logging.Level; 12 | 13 | /** 14 | * Created by tarun on 12.07.16. 15 | */ 16 | public class CustomEventListener extends AbstractWebDriverEventListener { 17 | 18 | boolean isJSErrorFound; 19 | 20 | 21 | private void logErrors(String url, LogEntries logEntries) { 22 | if (logEntries.getAll().size() == 0) { 23 | TestLogging.log("********* No Severe Error on Browser Console *********", true); 24 | } else { 25 | for (LogEntry logEntry : logEntries) { 26 | if (logEntry.getLevel().equals(Level.SEVERE)) { 27 | TestLogging.log("URL: "+url); 28 | TestLogging.logWebStep("Time stamp: " + logEntry.getTimestamp() + ", " + 29 | "Log level: " + logEntry 30 | .getLevel() + ", Log message: " + logEntry.getMessage(), true); 31 | isJSErrorFound = true; 32 | } 33 | } 34 | assert !isJSErrorFound; 35 | } 36 | } 37 | 38 | private void logErrors(String event, WebElement element, LogEntries logEntries) { 39 | if (logEntries.getAll().size() == 0) { 40 | TestLogging.log("********* No Severe Error on Browser Console *********", true); 41 | } else { 42 | for (LogEntry logEntry : logEntries) { 43 | if (logEntry.getLevel().equals(Level.SEVERE)) { 44 | TestLogging.log("Sever Console Error on Browser "+event+" clicking " + 45 | "element: " +((HtmlElement)element).getBy()); 46 | TestLogging.logWebStep("Time stamp: " + logEntry.getTimestamp() + ", " + 47 | "Log level: " + logEntry 48 | .getLevel() + ", Log message: " + logEntry.getMessage(), true); 49 | isJSErrorFound = true; 50 | } 51 | } 52 | assert !isJSErrorFound; 53 | } 54 | } 55 | 56 | private LogEntries getBrowserLogs(WebDriver webDriver) { 57 | return webDriver.manage().logs().get(LogType.BROWSER); 58 | } 59 | 60 | @Override 61 | public void beforeNavigateTo(String url, WebDriver webDriver) { 62 | logErrors(url, getBrowserLogs(webDriver)); 63 | 64 | } 65 | 66 | @Override 67 | public void afterNavigateTo(String url, WebDriver webDriver) { 68 | logErrors(url, getBrowserLogs(webDriver)); 69 | } 70 | 71 | @Override 72 | public void beforeClickOn(WebElement element, WebDriver driver) { 73 | logErrors("before", element, getBrowserLogs(driver)); 74 | } 75 | 76 | @Override 77 | public void afterClickOn(WebElement element, WebDriver driver) { 78 | logErrors("after", element, getBrowserLogs(driver)); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/core/DefaultTestNGContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.core; 15 | 16 | import java.util.Collection; 17 | import java.util.Date; 18 | import java.util.List; 19 | import java.util.Set; 20 | 21 | import org.testng.IClass; 22 | import org.testng.IResultMap; 23 | import org.testng.ISuite; 24 | import org.testng.ITestContext; 25 | import org.testng.ITestNGMethod; 26 | import org.testng.xml.XmlTest; 27 | 28 | import com.google.inject.Injector; 29 | import com.google.inject.Module; 30 | 31 | public class DefaultTestNGContext implements ITestContext { 32 | 33 | private static final long serialVersionUID = 2710769637263878789L; 34 | ISuite suite; 35 | 36 | public DefaultTestNGContext() { 37 | this.suite = new SeleniumTestsDefaultSuite(); 38 | } 39 | 40 | public Object getAttribute(final String name) { 41 | return null; 42 | } 43 | 44 | public void setAttribute(final String name, final Object value) { } 45 | 46 | public Set getAttributeNames() { 47 | return null; 48 | } 49 | 50 | public Object removeAttribute(final String name) { 51 | return null; 52 | } 53 | 54 | public String getName() { 55 | return null; 56 | } 57 | 58 | public Date getStartDate() { 59 | return null; 60 | } 61 | 62 | public Date getEndDate() { 63 | return null; 64 | } 65 | 66 | public IResultMap getPassedTests() { 67 | return null; 68 | } 69 | 70 | public IResultMap getSkippedTests() { 71 | return null; 72 | } 73 | 74 | public IResultMap getFailedButWithinSuccessPercentageTests() { 75 | return null; 76 | } 77 | 78 | public IResultMap getFailedTests() { 79 | return null; 80 | } 81 | 82 | public String[] getIncludedGroups() { 83 | return null; 84 | } 85 | 86 | public String[] getExcludedGroups() { 87 | return null; 88 | } 89 | 90 | public String getOutputDirectory() { 91 | return this.getClass().getResource("/").getPath() + "../../test-output/defaultSuite"; 92 | } 93 | 94 | public ISuite getSuite() { 95 | return suite; 96 | } 97 | 98 | public ITestNGMethod[] getAllTestMethods() { 99 | return null; 100 | } 101 | 102 | public String getHost() { 103 | return null; 104 | } 105 | 106 | public Collection getExcludedMethods() { 107 | return null; 108 | } 109 | 110 | public IResultMap getPassedConfigurations() { 111 | return null; 112 | } 113 | 114 | public IResultMap getSkippedConfigurations() { 115 | return null; 116 | } 117 | 118 | public IResultMap getFailedConfigurations() { 119 | return null; 120 | } 121 | 122 | public XmlTest getCurrentXmlTest() { 123 | return null; 124 | } 125 | 126 | public List getGuiceModules(final Class cls) { 127 | return null; 128 | } 129 | 130 | public void addGuiceModule(final Class cls, final Module module) { } 131 | 132 | public Injector getInjector(final List moduleInstances) { 133 | return null; 134 | } 135 | 136 | @Override 137 | public Injector getInjector(final IClass iClass) { 138 | return null; 139 | } 140 | 141 | public void addInjector(final List moduleInstances, final Injector injector) { } 142 | 143 | } 144 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/core/DefaultXmlSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.core; 15 | 16 | import org.testng.xml.XmlSuite; 17 | 18 | public class DefaultXmlSuite extends XmlSuite { 19 | 20 | private static final long serialVersionUID = -5443556778899088771L; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/core/IContextAttributeListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.core; 15 | 16 | import org.testng.ITestContext; 17 | 18 | public interface IContextAttributeListener { 19 | void load(ITestContext testNGCtx, SeleniumTestsContext seleniumTestsCtx); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/core/Locator.java: -------------------------------------------------------------------------------- 1 | package com.seleniumtests.core; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | /** 6 | * @author tbhadauria 7 | */ 8 | public class Locator { 9 | 10 | // To Do - should not return By object but hide it. https://sourcemaking.com/design_patterns/facade/java/1 11 | 12 | public static By locateByName(final String name) { 13 | return By.name(name); 14 | } 15 | 16 | public static By locateById(final String id) { 17 | return By.id(id); 18 | } 19 | 20 | public static By locateByCSSSelector(final String cssSelector) { 21 | return By.cssSelector(cssSelector); 22 | } 23 | 24 | public static By locateByXPath(final String xPath) { 25 | return By.xpath(xPath); 26 | } 27 | 28 | public static By locateByLinkText(final String linkText) { 29 | return By.linkText(linkText); 30 | } 31 | 32 | public static By locateByPartialLinkText(final String partialLinkText) { 33 | return By.partialLinkText(partialLinkText); 34 | } 35 | 36 | public static By locateByClassName(final String className) { 37 | return By.className(className); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/core/SeleniumTestsDefaultSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.core; 15 | 16 | import java.util.Collection; 17 | import java.util.List; 18 | import java.util.Map; 19 | import java.util.Set; 20 | 21 | import org.testng.IInvokedMethod; 22 | import org.testng.IObjectFactory; 23 | import org.testng.IObjectFactory2; 24 | import org.testng.ISuite; 25 | import org.testng.ISuiteResult; 26 | import org.testng.ITestNGListener; 27 | import org.testng.ITestNGMethod; 28 | import org.testng.SuiteRunState; 29 | import org.testng.internal.annotations.IAnnotationFinder; 30 | import org.testng.xml.XmlSuite; 31 | 32 | import com.google.inject.Injector; 33 | 34 | public class SeleniumTestsDefaultSuite implements ISuite { 35 | 36 | private static final long serialVersionUID = -152933123712833411L; 37 | private final XmlSuite xmlSuite; 38 | 39 | public SeleniumTestsDefaultSuite() { 40 | this.xmlSuite = new DefaultXmlSuite(); 41 | } 42 | 43 | public Object getAttribute(final String name) { 44 | return null; 45 | } 46 | 47 | public void setAttribute(final String name, final Object value) { } 48 | 49 | public Set getAttributeNames() { 50 | return null; 51 | } 52 | 53 | public Object removeAttribute(final String name) { 54 | return null; 55 | } 56 | 57 | public String getName() { 58 | return "Default suite"; 59 | } 60 | 61 | public Map getResults() { 62 | return null; 63 | } 64 | 65 | public IObjectFactory getObjectFactory() { 66 | return null; 67 | } 68 | 69 | public IObjectFactory2 getObjectFactory2() { 70 | return null; 71 | } 72 | 73 | public String getOutputDirectory() { 74 | return null; 75 | } 76 | 77 | public String getParallel() { 78 | return null; 79 | } 80 | 81 | @Override 82 | public String getParentModule() { 83 | return null; 84 | } 85 | 86 | @Override 87 | public String getGuiceStage() { 88 | return null; 89 | } 90 | 91 | public String getParameter(final String parameterName) { 92 | return null; 93 | } 94 | 95 | public Map> getMethodsByGroups() { 96 | return null; 97 | } 98 | 99 | public Collection getInvokedMethods() { 100 | return null; 101 | } 102 | 103 | public List getAllInvokedMethods() { 104 | return null; 105 | } 106 | 107 | public Collection getExcludedMethods() { 108 | return null; 109 | } 110 | 111 | public void run() { } 112 | 113 | public String getHost() { 114 | return null; 115 | } 116 | 117 | public SuiteRunState getSuiteState() { 118 | return null; 119 | } 120 | 121 | public IAnnotationFinder getAnnotationFinder() { 122 | return null; 123 | } 124 | 125 | public XmlSuite getXmlSuite() { 126 | return xmlSuite; 127 | } 128 | 129 | public void addListener(final ITestNGListener listener) { } 130 | 131 | @Override 132 | public Injector getParentInjector() { 133 | return null; 134 | } 135 | 136 | @Override 137 | public void setParentInjector(final Injector injector) { 138 | 139 | } 140 | 141 | public List getAllMethods() { 142 | return null; 143 | } 144 | 145 | } 146 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/core/SeleniumTestsPageListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.core; 15 | 16 | import org.apache.log4j.Logger; 17 | 18 | import com.seleniumtests.reporter.PluginsHelper; 19 | import com.seleniumtests.webelements.IPage; 20 | 21 | /** 22 | * Plugin architecture for SEO, Java Script, Accessibility etc functional tests. 23 | */ 24 | public abstract class SeleniumTestsPageListener { 25 | protected static final Logger logger = TestLogging.getLogger(SeleniumTestsPageListener.class); 26 | 27 | /** 28 | * Informs all the page listeners on page Load. 29 | * 30 | * @param page 31 | */ 32 | public static void informPageLoad(final IPage page) { 33 | PluginsHelper.getInstance().invokePageListeners(SeleniumTestsContextManager.getThreadContext() 34 | .getTestMethodSignature(), page, true); 35 | } 36 | 37 | /** 38 | * Informs all the page listeners on page Unload. 39 | * 40 | * @param page 41 | */ 42 | public static void informPageUnload(final IPage page) { 43 | PluginsHelper.getInstance().invokePageListeners(SeleniumTestsContextManager.getThreadContext() 44 | .getTestMethodSignature(), page, false); 45 | } 46 | 47 | private String title; 48 | 49 | private boolean testResultEffected; 50 | 51 | public SeleniumTestsPageListener(final String title, final boolean testResultEffected) { 52 | this.title = title; 53 | this.testResultEffected = testResultEffected; 54 | } 55 | 56 | public SeleniumTestsPageListener() { } 57 | 58 | public String getTitle() { 59 | return title; 60 | } 61 | 62 | public boolean isTestResultEffected() { 63 | return testResultEffected; 64 | } 65 | 66 | public abstract void onPageLoad(IPage page); 67 | 68 | public abstract void onPageUnload(IPage page); 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/core/TearDownService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.core; 15 | 16 | /** 17 | * Use this interface to clean up resources after a test method is completed executing. 18 | */ 19 | public interface TearDownService { 20 | 21 | void tearDown(); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/core/TestRetryAnalyzer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.core; 15 | 16 | import org.testng.IRetryAnalyzer; 17 | import org.testng.ITestResult; 18 | 19 | public class TestRetryAnalyzer implements IRetryAnalyzer { 20 | 21 | private static final int MAX_RETRY_COUNT = 3; 22 | private int count = MAX_RETRY_COUNT; 23 | 24 | public int getCount() { 25 | return count; 26 | } 27 | 28 | @Override 29 | public boolean retry(ITestResult result) { 30 | boolean retryAgain = false; 31 | if (count > 0) { 32 | System.out.println("Going to retry test case: " + result.getMethod() + ", " + (( 33 | (MAX_RETRY_COUNT - count) + 1)) + " out of " + MAX_RETRY_COUNT); 34 | retryAgain = true; 35 | --count; 36 | } 37 | return retryAgain; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/core/TestRetryListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.core; 15 | 16 | import java.lang.reflect.Constructor; 17 | import java.lang.reflect.Method; 18 | 19 | import org.testng.IAnnotationTransformer; 20 | import org.testng.IRetryAnalyzer; 21 | import org.testng.annotations.ITestAnnotation; 22 | 23 | public class TestRetryListener implements IAnnotationTransformer { 24 | 25 | public void transform(final ITestAnnotation annotation, final Class testClass, final Constructor testConstructor, 26 | final Method testMethod) { 27 | IRetryAnalyzer retryAnalyzer = annotation.getRetryAnalyzer(); 28 | if (retryAnalyzer == null) { 29 | annotation.setRetryAnalyzer(TestRetryAnalyzer.class); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/customFFprofile/FireFoxProfileMarker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.customFFprofile; 15 | 16 | /** 17 | * FireFoxProfileMarker. 18 | */ 19 | public class FireFoxProfileMarker { } 20 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/customexception/CustomSeleniumTestsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.customexception; 15 | 16 | public class CustomSeleniumTestsException extends Exception { 17 | 18 | private static final long serialVersionUID = -5567383832452234582L; 19 | 20 | public CustomSeleniumTestsException() { } 21 | 22 | public CustomSeleniumTestsException(final String message) { 23 | super(message); 24 | } 25 | 26 | public CustomSeleniumTestsException(final Throwable cause) { 27 | super(cause); 28 | } 29 | 30 | public CustomSeleniumTestsException(final String message, final Throwable cause) { 31 | super(message, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/customexception/DriverExceptions.java: -------------------------------------------------------------------------------- 1 | package com.seleniumtests.customexception; 2 | 3 | public class DriverExceptions extends RuntimeException { 4 | 5 | public DriverExceptions(final String message, final Throwable throwable) { 6 | super(message, throwable); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/customexception/NotCurrentPageException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.customexception; 15 | 16 | public class NotCurrentPageException extends CustomSeleniumTestsException { 17 | 18 | private static final long serialVersionUID = -5663838190837384823L; 19 | 20 | public NotCurrentPageException() { } 21 | 22 | public NotCurrentPageException(final String message) { 23 | super(message); 24 | } 25 | 26 | public NotCurrentPageException(final Throwable cause) { 27 | super(cause); 28 | } 29 | 30 | public NotCurrentPageException(final String message, final Throwable cause) { 31 | super(message, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/customexception/WebSessionEndedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.customexception; 15 | 16 | import org.openqa.selenium.WebDriverException; 17 | 18 | public class WebSessionEndedException extends WebDriverException { 19 | 20 | private static final long serialVersionUID = -647233887439084123L; 21 | 22 | public WebSessionEndedException() { 23 | super(); 24 | } 25 | 26 | public WebSessionEndedException(final Throwable ex) { 27 | super(ex); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/driver/BrowserType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.driver; 15 | 16 | public enum BrowserType { 17 | FireFox("*firefox"), 18 | Marionette("*marionette"), 19 | InternetExplore("*iexplore"), 20 | Chrome("*chrome"), 21 | Safari("*safari"), 22 | Android("*android"), 23 | IPhone("*iphone"), 24 | PhantomJS("*phantomjs"), 25 | SauceLabs("*saucelabs"); 26 | 27 | public static BrowserType getBrowserType(final String browserType) { 28 | if (browserType.equalsIgnoreCase("*firefox") || browserType.equalsIgnoreCase("firefox")) { 29 | return BrowserType.FireFox; 30 | }if (browserType.equalsIgnoreCase("*marionette") || browserType.equalsIgnoreCase("marionette")) { 31 | return BrowserType.Marionette; 32 | } else if (browserType.equalsIgnoreCase("*iexplore") || browserType.equalsIgnoreCase("iexplore")) { 33 | return BrowserType.InternetExplore; 34 | } else if (browserType.equalsIgnoreCase("*chrome") || browserType.equalsIgnoreCase("chrome")) { 35 | return BrowserType.Chrome; 36 | } else if (browserType.equalsIgnoreCase("*safari") || browserType.equalsIgnoreCase("safari")) { 37 | return BrowserType.Safari; 38 | } else if (browserType.equalsIgnoreCase("*android") || browserType.equalsIgnoreCase("android")) { 39 | return BrowserType.Android; 40 | } else if (browserType.equalsIgnoreCase("*iphone") || browserType.equalsIgnoreCase("iphone")) { 41 | return BrowserType.IPhone; 42 | }else if (browserType.equalsIgnoreCase("*phantomjs") || browserType.equalsIgnoreCase("phantomjs")) { 43 | return BrowserType.PhantomJS; 44 | } else if (browserType.equalsIgnoreCase("*saucelabs") || browserType.equalsIgnoreCase("saucelabs")) { 45 | return BrowserType.SauceLabs; 46 | } else { 47 | return BrowserType.FireFox; 48 | } 49 | } 50 | 51 | private String browserType; 52 | 53 | BrowserType(final String type) { 54 | this.browserType = type; 55 | } 56 | 57 | public String getBrowserType() { 58 | return this.browserType; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/driver/CustomEventFiringWebDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.driver; 15 | 16 | import org.openqa.selenium.WebDriver; 17 | import org.openqa.selenium.WebDriverException; 18 | import org.openqa.selenium.remote.FileDetector; 19 | import org.openqa.selenium.remote.UselessFileDetector; 20 | import org.openqa.selenium.support.events.EventFiringWebDriver; 21 | 22 | /** 23 | * Supports file upload in remote webdriver. 24 | */ 25 | public class CustomEventFiringWebDriver extends EventFiringWebDriver { 26 | private FileDetector fileDetector = new UselessFileDetector(); 27 | private WebDriver driver = null; 28 | 29 | public CustomEventFiringWebDriver(final WebDriver driver) { 30 | super(driver); 31 | this.driver = driver; 32 | } 33 | 34 | public void setFileDetector(final FileDetector detector) { 35 | if (detector == null) { 36 | throw new WebDriverException("file detector is null"); 37 | } 38 | 39 | fileDetector = detector; 40 | } 41 | 42 | public FileDetector getFileDetector() { 43 | return fileDetector; 44 | } 45 | 46 | public WebDriver getWebDriver() { 47 | return driver; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/driver/DriverMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.driver; 15 | 16 | public enum DriverMode { 17 | LOCAL, 18 | ExistingGrid, 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/driver/ScreenShot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.driver; 15 | 16 | import com.seleniumtests.core.SeleniumTestsContextManager; 17 | 18 | public class ScreenShot { 19 | 20 | private String location; 21 | private String htmlSourcePath; 22 | private String imagePath; 23 | private String title; 24 | private String suiteName; 25 | private boolean isException; 26 | private String outputDirectory; 27 | 28 | public ScreenShot() { 29 | if (SeleniumTestsContextManager.getGlobalContext().getTestNGContext() != null) { 30 | suiteName = SeleniumTestsContextManager.getGlobalContext().getTestNGContext().getSuite().getName(); 31 | outputDirectory = SeleniumTestsContextManager.getGlobalContext().getTestNGContext().getOutputDirectory(); 32 | } 33 | } 34 | 35 | public boolean isException() { 36 | return isException; 37 | } 38 | 39 | public void setException(final boolean isException) { 40 | this.isException = isException; 41 | } 42 | 43 | public String getSuiteName() { 44 | return suiteName; 45 | } 46 | 47 | public String getOutputDirectory() { 48 | return outputDirectory; 49 | } 50 | 51 | public void setOutputDirectory(final String outputDirectory) { 52 | this.outputDirectory = outputDirectory; 53 | } 54 | 55 | public void setSuiteName(final String suiteName) { 56 | this.suiteName = suiteName; 57 | } 58 | 59 | public String getLocation() { 60 | return location; 61 | } 62 | 63 | public void setLocation(final String location) { 64 | this.location = location; 65 | } 66 | 67 | public void setHtmlSourcePath(final String htmlSourcePath) { 68 | this.htmlSourcePath = htmlSourcePath; 69 | } 70 | 71 | public void setImagePath(final String imagePath) { 72 | this.imagePath = imagePath; 73 | } 74 | 75 | public String getHtmlSourcePath() { 76 | return htmlSourcePath; 77 | } 78 | 79 | public String getImagePath() { 80 | return imagePath; 81 | } 82 | 83 | public String getTitle() { 84 | return title; 85 | } 86 | 87 | public void setTitle(final String title) { 88 | this.title = title; 89 | } 90 | 91 | public String getFullImagePath() { 92 | if (this.imagePath != null) { 93 | return this.imagePath.replace(suiteName, outputDirectory); 94 | } else { 95 | return null; 96 | } 97 | } 98 | 99 | public String getFullHtmlPath() { 100 | if (this.htmlSourcePath != null) { 101 | return this.htmlSourcePath.replace(suiteName, outputDirectory); 102 | } else { 103 | return null; 104 | } 105 | } 106 | 107 | @Override 108 | public String toString() { 109 | return "!!!EXCEPTION:" + this.isException + "|APPLICATION URL:" + this.location + "|PAGE TITLE:" + this.title 110 | + "|PAGE HTML SOURCE:" + this.getFullHtmlPath() + "|PAGE IMAGE:" + this.getFullImagePath(); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/driver/ScreenShotRemoteWebDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.driver; 15 | 16 | import java.net.URL; 17 | 18 | import org.openqa.selenium.OutputType; 19 | import org.openqa.selenium.TakesScreenshot; 20 | import org.openqa.selenium.WebDriverException; 21 | import org.openqa.selenium.remote.CapabilityType; 22 | import org.openqa.selenium.remote.DesiredCapabilities; 23 | import org.openqa.selenium.remote.DriverCommand; 24 | import org.openqa.selenium.remote.RemoteWebDriver; 25 | 26 | public class ScreenShotRemoteWebDriver extends RemoteWebDriver implements TakesScreenshot { 27 | public ScreenShotRemoteWebDriver(final DesiredCapabilities capabilities) { 28 | super(capabilities); 29 | } 30 | 31 | public ScreenShotRemoteWebDriver(final URL url, final DesiredCapabilities capabilities) { 32 | super(url, capabilities); 33 | } 34 | 35 | public ScreenShotRemoteWebDriver() { } 36 | 37 | public X getScreenshotAs(final OutputType target) throws WebDriverException { 38 | if ((Boolean) getCapabilities().getCapability(CapabilityType.TAKES_SCREENSHOT)) { 39 | String output = execute(DriverCommand.SCREENSHOT).getValue().toString(); 40 | return target.convertFromBase64Png(output); 41 | } 42 | 43 | return null; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/driver/TestType.java: -------------------------------------------------------------------------------- 1 | package com.seleniumtests.driver; 2 | 3 | /** 4 | * @author tbhadauria 5 | */ 6 | public enum TestType { 7 | 8 | WEB("web"), 9 | APP("app"), 10 | NON_GUI("NonGUI"), 11 | APPIUM_WEB_ANDROID("appium_web_android"), 12 | APPIUM_WEB_IOS("appium_web_ios"); 13 | 14 | String testType; 15 | 16 | TestType(final String testType) { 17 | this.testType = testType; 18 | } 19 | 20 | public String getTestType() { 21 | return testType; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/driver/WebUtility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.driver; 15 | 16 | import org.openqa.selenium.Dimension; 17 | import org.openqa.selenium.JavascriptExecutor; 18 | import org.openqa.selenium.Point; 19 | import org.openqa.selenium.WebDriver; 20 | 21 | import com.seleniumtests.core.TestLogging; 22 | 23 | public class WebUtility { 24 | private WebDriver driver; 25 | 26 | public WebUtility(final WebDriver driver) { 27 | this.driver = driver; 28 | } 29 | 30 | /** 31 | * Resize window to given dimensions. 32 | * 33 | * @param width 34 | * @param height 35 | */ 36 | public void resizeWindow(final int width, final int height) { 37 | try { 38 | TestLogging.logWebStep("Resize browser window to width " + width + " height " + height, false); 39 | 40 | Dimension size = new Dimension(width, height); 41 | driver.manage().window().setPosition(new Point(0, 0)); 42 | driver.manage().window().setSize(size); 43 | } catch (Exception ex) { } 44 | } 45 | 46 | public void maximizeWindow() { 47 | try { 48 | BrowserType browser = BrowserType.getBrowserType(WebUIDriver.getWebUIDriver().getBrowser()); 49 | if (browser == BrowserType.Android || browser == BrowserType.IPhone) { 50 | return; 51 | } 52 | 53 | driver.manage().window().maximize(); 54 | } catch (Exception ex) { 55 | 56 | try { 57 | ((JavascriptExecutor) driver).executeScript( 58 | "if (window.screen){window.moveTo(0, 0);window.resizeTo(window.screen.availWidth,window.screen.availHeight);}"); 59 | } catch (Exception ignore) { 60 | TestLogging.log("Unable to maximize browser window. Exception occured: " + ignore.getMessage()); 61 | } 62 | } 63 | } 64 | 65 | public static void main(final String[] args) { 66 | WebUIDriver.getWebUIDriver().setMode("ExistingGrid"); 67 | WebUIDriver.getWebUIDriver().setHubUrl(" "); 68 | 69 | WebDriver driver = WebUIDriver.getWebDriver(true); 70 | System.out.print(driver.manage().window().getSize().width + ":" + driver.manage().window().getSize().height); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/helper/ContextHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.helper; 15 | 16 | public class ContextHelper { 17 | 18 | private static class Helper extends SecurityManager { 19 | 20 | Class[] getContext() { 21 | return getClassContext(); 22 | } 23 | } 24 | 25 | private static final Helper HELPER = new Helper(); 26 | 27 | public static Class getCaller() { 28 | Class[] classContext = HELPER.getContext(); 29 | return classContext[3]; 30 | } 31 | 32 | public static String getCallerMethod() { 33 | StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); 34 | return stackTrace[3].getMethodName(); 35 | } 36 | 37 | public static void main(final String[] st) { 38 | System.out.println(getCallerMethod()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/helper/HashCodeGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.helper; 15 | 16 | import java.math.BigInteger; 17 | import java.security.MessageDigest; 18 | import java.util.UUID; 19 | 20 | import org.apache.log4j.Logger; 21 | 22 | import com.seleniumtests.core.SeleniumTestsContextManager; 23 | 24 | public class HashCodeGenerator { 25 | 26 | private static Logger logger = Logger.getLogger(HashCodeGenerator.class); 27 | 28 | public static String getRandomHashCode(final String seed) { 29 | String signature; 30 | if (SeleniumTestsContextManager.getThreadContext() != null) { 31 | signature = SeleniumTestsContextManager.getThreadContext().getTestMethodSignature(); 32 | } else { 33 | signature = ""; 34 | } 35 | 36 | byte[] data = (signature + UUID.randomUUID().getLeastSignificantBits() + seed).getBytes(); 37 | try { 38 | MessageDigest digest = MessageDigest.getInstance("MD5"); 39 | return new BigInteger(1, digest.digest(data)).toString(16); 40 | } catch (Exception e2) { } 41 | 42 | return new String(data); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/helper/OSUtility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.helper; 15 | 16 | import java.io.BufferedReader; 17 | import java.io.IOException; 18 | import java.io.InputStreamReader; 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | public class OSUtility { 23 | 24 | public static String getOSName() { 25 | return System.getProperty("os.name"); 26 | } 27 | 28 | public static boolean isMac() { 29 | return getOSName().startsWith("Mac"); 30 | } 31 | 32 | public static boolean isWindows() { 33 | return getOSName().startsWith("Win"); 34 | } 35 | 36 | public static String getOSBits() { 37 | return System.getProperty("os.arch"); 38 | } 39 | 40 | public static boolean is32() { 41 | return getOSBits().equals("x86"); 42 | } 43 | 44 | public static boolean is64() { 45 | if (isWindows()) { 46 | return (System.getenv("ProgramW6432") != null); 47 | } else { 48 | return !getOSBits().equals("x86"); 49 | } 50 | } 51 | 52 | private static List executeCommand(final String cmd) { 53 | List output = new ArrayList(); 54 | Process p; 55 | try { 56 | p = Runtime.getRuntime().exec(cmd); 57 | } catch (IOException e1) { 58 | return output; 59 | } 60 | 61 | BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()), 8 * 1024); 62 | String s = null; 63 | try { 64 | while ((s = stdInput.readLine()) != null) { 65 | output.add(s); 66 | } 67 | } catch (IOException e) { 68 | return output; 69 | } 70 | 71 | return output; 72 | } 73 | 74 | public static int getIEVersion() { 75 | List output; 76 | output = executeCommand("reg query \"HKLM\\Software\\Microsoft\\Internet Explorer\" /v svcVersion"); 77 | if (output.size() < 3) { 78 | output = executeCommand("reg query \"HKLM\\Software\\Microsoft\\Internet Explorer\" /v Version"); 79 | } 80 | 81 | String internet_explorer_value = (output.get(2)); 82 | String version = internet_explorer_value.trim().split(" ")[2]; 83 | version = version.trim().split("\\.")[0]; 84 | return Integer.parseInt(version); 85 | } 86 | 87 | public static String getSlash() { 88 | if (isWindows()) { 89 | return "\\"; 90 | } else { 91 | return "/"; 92 | } 93 | } 94 | 95 | public static void main(final String[] args) { 96 | 97 | System.out.println(getIEVersion()); 98 | 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/helper/StringUtility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.helper; 15 | 16 | import java.lang.reflect.Method; 17 | import java.nio.charset.StandardCharsets; 18 | import java.security.MessageDigest; 19 | import java.security.NoSuchAlgorithmException; 20 | 21 | public class StringUtility { 22 | 23 | public static String constructMethodSignature(final Method method, final Object[] parameters) { 24 | return method.getDeclaringClass().getCanonicalName() + "." + method.getName() + "(" 25 | + constructParameterString(parameters) + ")"; 26 | } 27 | 28 | public static String constructParameterString(final Object[] parameters) { 29 | StringBuffer sbParam = new StringBuffer(); 30 | 31 | if (parameters != null) { 32 | for (int i = 0; i < parameters.length; i++) { 33 | if (parameters[i] == null) { 34 | sbParam.append("null, "); 35 | } else if (parameters[i] instanceof java.lang.String) { 36 | sbParam.append("\"").append(parameters[i]).append("\", "); 37 | } else { 38 | sbParam.append(parameters[i]).append(", "); 39 | } 40 | } 41 | } 42 | 43 | if (sbParam.length() > 0) { 44 | sbParam.delete(sbParam.length() - 2, sbParam.length() - 1); 45 | } 46 | 47 | return sbParam.toString(); 48 | } 49 | 50 | public static String md5(final String str) { 51 | 52 | if (str == null) { 53 | return null; 54 | } 55 | 56 | MessageDigest messageDigest = null; 57 | 58 | try { 59 | messageDigest = MessageDigest.getInstance("MD5"); 60 | messageDigest.reset(); 61 | messageDigest.update(str.getBytes(StandardCharsets.UTF_8)); 62 | } catch (NoSuchAlgorithmException e) { 63 | e.printStackTrace(); 64 | return str; 65 | } 66 | 67 | byte[] byteArray = messageDigest.digest(); 68 | 69 | return toHexString(byteArray); 70 | } 71 | 72 | public static String toHexString(byte[] byteArray) { 73 | StringBuilder builder = new StringBuilder(); 74 | 75 | for (int i = 0; i < byteArray.length; i++) { 76 | if (Integer.toHexString(0xFF & byteArray[i]).length() == 1) 77 | builder.append("0").append(Integer.toHexString(0xFF & byteArray[i])); 78 | else 79 | builder.append(Integer.toHexString(0xFF & byteArray[i])); 80 | } 81 | 82 | return builder.toString(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/helper/WaitHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.helper; 15 | 16 | public class WaitHelper { 17 | 18 | /** 19 | * Wait For seconds. 20 | * 21 | * @param seconds 22 | */ 23 | public static void waitForSeconds(final int seconds) { 24 | try { 25 | Thread.sleep(seconds * 1000); 26 | } catch (InterruptedException ignore) { } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/helper/XMLUtility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.helper; 15 | 16 | import java.io.File; 17 | 18 | import javax.xml.parsers.DocumentBuilder; 19 | import javax.xml.parsers.DocumentBuilderFactory; 20 | 21 | import org.w3c.dom.Document; 22 | import org.w3c.dom.NodeList; 23 | 24 | public class XMLUtility { 25 | 26 | public static NodeList getXMLNodes(final String xmlFileName, final String tagName) { 27 | NodeList nList = null; 28 | try { 29 | File xmlFile = new File(xmlFileName); 30 | DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); 31 | DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); 32 | Document doc = dBuilder.parse(xmlFile); 33 | doc.getDocumentElement().normalize(); 34 | nList = doc.getElementsByTagName(tagName); 35 | } catch (Exception e) { 36 | e.printStackTrace(); 37 | } 38 | 39 | return nList; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/reporter/ElaborateLog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.reporter; 15 | 16 | public class ElaborateLog { 17 | 18 | private String type; 19 | private String msg; 20 | private String screen; 21 | private String src; 22 | private String location; 23 | private String href; 24 | 25 | private String root; 26 | 27 | public ElaborateLog(final String s, final String root) { 28 | this.root = root; 29 | if (s == null) { 30 | return; 31 | } 32 | 33 | String[] parts = s.split("\\|\\|"); 34 | for (String part : parts) { 35 | parse(part); 36 | } 37 | } 38 | 39 | public String getHref() { 40 | return href; 41 | } 42 | 43 | public String getLocation() { 44 | return location; 45 | } 46 | 47 | public String getMsg() { 48 | return msg; 49 | } 50 | 51 | private void parse(final String part) { 52 | if (part.startsWith("TYPE=")) { 53 | type = part.replace("TYPE=", ""); 54 | } else if (part.startsWith("MSG=")) { 55 | msg = part.replace("MSG=", ""); 56 | } else if (part.startsWith("SCREEN=")) { 57 | screen = part.replace("SCREEN=", ""); 58 | } else if (part.startsWith("SRC=")) { 59 | src = part.replace("SRC=", ""); 60 | } else if (part.startsWith("LOCATION=")) { 61 | location = part.replace("LOCATION=", ""); 62 | } else if (part.startsWith("HREF=")) { 63 | href = part.replace("HREF=", ""); 64 | } else { 65 | msg = part; 66 | } 67 | 68 | } 69 | 70 | public String toString() { 71 | StringBuilder buff = new StringBuilder(); 72 | buff.append("TYPE="); 73 | if (type != null) { 74 | buff.append(type); 75 | } 76 | 77 | buff.append("||MSG="); 78 | if (msg != null) { 79 | buff.append(msg); 80 | } 81 | 82 | buff.append("||SCREEN="); 83 | if (screen != null) { 84 | buff.append(screen); 85 | } 86 | 87 | buff.append("||SRC="); 88 | if (src != null) { 89 | buff.append(src); 90 | } 91 | 92 | buff.append("||LOCATION="); 93 | if (location != null) { 94 | buff.append(location); 95 | } 96 | 97 | buff.append("||HREF="); 98 | if (href != null) { 99 | buff.append(href); 100 | } 101 | 102 | return buff.toString(); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/reporter/ShortTestResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.reporter; 15 | 16 | import com.seleniumtests.helper.StringUtility; 17 | 18 | public class ShortTestResult { 19 | 20 | private String name; 21 | private String id; 22 | 23 | private int totalMethod; 24 | 25 | private int instancesPassed; 26 | 27 | private int instancesFailed; 28 | 29 | private int instancesSkipped; 30 | 31 | public ShortTestResult(final String name) { 32 | this.name = name; 33 | this.id = StringUtility.md5(name); 34 | } 35 | 36 | public String getId() { 37 | return id; 38 | } 39 | 40 | public int getInstancesFailed() { 41 | return instancesFailed; 42 | } 43 | 44 | public int getInstancesPassed() { 45 | return instancesPassed; 46 | } 47 | 48 | public int getInstancesSkipped() { 49 | return instancesSkipped; 50 | 51 | } 52 | 53 | public String getName() { 54 | return name; 55 | } 56 | 57 | public int getTotalMethod() { 58 | return totalMethod; 59 | } 60 | 61 | public void setId(final String id) { 62 | this.id = id; 63 | } 64 | 65 | public void setInstancesFailed(final int instancesFailed) { 66 | this.instancesFailed = instancesFailed; 67 | } 68 | 69 | public void setInstancesPassed(final int instancesPassed) { 70 | this.instancesPassed = instancesPassed; 71 | } 72 | 73 | public void setInstancesSkipped(final int instancesSkipped) { 74 | this.instancesSkipped = instancesSkipped; 75 | } 76 | 77 | public void setName(final String name) { 78 | this.name = name; 79 | } 80 | 81 | public void setTotalMethod(final int totalMethod) { 82 | this.totalMethod = totalMethod; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/reporter/pluginmodel/Method.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.reporter.pluginmodel; 15 | 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | import javax.xml.bind.annotation.XmlAccessType; 20 | import javax.xml.bind.annotation.XmlAccessorType; 21 | import javax.xml.bind.annotation.XmlAttribute; 22 | import javax.xml.bind.annotation.XmlRootElement; 23 | import javax.xml.bind.annotation.XmlType; 24 | 25 | /** 26 | *

Java class for anonymous complex type. 27 | * 28 | *

29 | *

The following schema fragment specifies the expected content contained within this class. 30 | * 31 | *

32 | *

 33 |    <complexType>
 34 |      <complexContent>
 35 |        <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 36 |          <sequence>
 37 |            <element ref="{}page" maxOccurs="unbounded" minOccurs="0"/>
 38 |          </sequence>
 39 |          <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 40 |        </restriction>
 41 |      </complexContent>
 42 |    </complexType>
 43 |  * 
44 | */ 45 | @XmlAccessorType(XmlAccessType.FIELD) 46 | @XmlType(name = "", propOrder = {"page"}) 47 | @XmlRootElement(name = "method") 48 | public class Method { 49 | 50 | protected List page; 51 | @XmlAttribute(required = true) 52 | protected String name; 53 | 54 | /** 55 | * Gets the value of the name property. 56 | * 57 | * @return possible object is {@link String } 58 | */ 59 | public String getName() { 60 | return name; 61 | } 62 | 63 | /** 64 | * Gets the value of the page property. 65 | * 66 | *

67 | *

This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you 68 | * make to the returned list will be present inside the JAXB object. This is why there is not a set 69 | * method for the page property. 70 | * 71 | *

72 | *

For example, to add a new item, do as follows: 73 | * 74 | *

75 | *

 76 |        getPage().add(newItem);
 77 |      * 
78 | * 79 | *

80 | *

81 | *

Objects of the following type(s) are allowed in the list {@link Page } 82 | */ 83 | public List getPage() { 84 | if (page == null) { 85 | page = new ArrayList(); 86 | } 87 | 88 | return this.page; 89 | } 90 | 91 | /** 92 | * Sets the value of the name property. 93 | * 94 | * @param value allowed object is {@link String } 95 | */ 96 | public void setName(final String value) { 97 | this.name = value; 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/reporter/pluginmodel/Page.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.reporter.pluginmodel; 15 | 16 | import javax.xml.bind.annotation.XmlAccessType; 17 | import javax.xml.bind.annotation.XmlAccessorType; 18 | import javax.xml.bind.annotation.XmlAttribute; 19 | import javax.xml.bind.annotation.XmlRootElement; 20 | import javax.xml.bind.annotation.XmlType; 21 | 22 | /** 23 | *

Java class for anonymous complex type. 24 | * 25 | *

26 | *

The following schema fragment specifies the expected content contained within this class. 27 | * 28 | *

29 | *

30 |    <complexType>
31 |      <complexContent>
32 |        <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
33 |          <attribute name="class-name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
34 |        </restriction>
35 |      </complexContent>
36 |    </complexType>
37 |  * 
38 | */ 39 | @XmlAccessorType(XmlAccessType.FIELD) 40 | @XmlType(name = "") 41 | @XmlRootElement(name = "page") 42 | public class Page { 43 | 44 | @XmlAttribute(name = "class-name", required = true) 45 | protected String className; 46 | 47 | /** 48 | * Gets the value of the className property. 49 | * 50 | * @return possible object is {@link String } 51 | */ 52 | public String getClassName() { 53 | return className; 54 | } 55 | 56 | /** 57 | * Sets the value of the className property. 58 | * 59 | * @param value allowed object is {@link String } 60 | */ 61 | public void setClassName(final String value) { 62 | this.className = value; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/reporter/pluginmodel/SeleniumTestsPlugins.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.reporter.pluginmodel; 15 | 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | import javax.xml.bind.annotation.XmlAccessType; 20 | import javax.xml.bind.annotation.XmlAccessorType; 21 | import javax.xml.bind.annotation.XmlElement; 22 | import javax.xml.bind.annotation.XmlRootElement; 23 | import javax.xml.bind.annotation.XmlType; 24 | 25 | /** 26 | *

Java class for anonymous complex type. 27 | * 28 | *

29 | *

The following schema fragment specifies the expected content contained within this class. 30 | * 31 | *

32 | *

33 |    <complexType>
34 |      <complexContent>
35 |        <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
36 |          <sequence>
37 |            <element ref="{}plugin" maxOccurs="unbounded"/>
38 |          </sequence>
39 |        </restriction>
40 |      </complexContent>
41 |    </complexType>
42 |  * 
43 | */ 44 | @XmlAccessorType(XmlAccessType.FIELD) 45 | @XmlType(name = "", propOrder = {"plugin"}) 46 | @XmlRootElement(name = "plugins") 47 | public class SeleniumTestsPlugins { 48 | 49 | @XmlElement(required = true) 50 | protected List plugin; 51 | 52 | /** 53 | * Gets the value of the plugin property. 54 | * 55 | *

56 | *

This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you 57 | * make to the returned list will be present inside the JAXB object. This is why there is not a set 58 | * method for the plugin property. 59 | * 60 | *

61 | *

For example, to add a new item, do as follows: 62 | * 63 | *

64 | *

65 |        getPlugin().add(newItem);
66 |      * 
67 | * 68 | *

69 | *

70 | *

Objects of the following type(s) are allowed in the list {@link Plugin } 71 | */ 72 | public List getPlugin() { 73 | if (plugin == null) { 74 | plugin = new ArrayList(); 75 | } 76 | 77 | return this.plugin; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/resources/WebDriverExternalResources.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.resources; 15 | 16 | /** 17 | * Class to locate for web driver external resources like IEDriver.exe, ChromeDriver.exe. 18 | */ 19 | public class WebDriverExternalResources { } 20 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/util/internal/entity/TestEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.util.internal.entity; 15 | 16 | public class TestEntity { 17 | public static final String TEST_METHOD = "TestEntity.TestMethod"; 18 | public static final String TEST_DP_TAGS = "TestEntity.TestTags"; 19 | 20 | private String testCaseId = ""; 21 | private String testMethod = ""; 22 | 23 | public String getTestCaseId() { 24 | return testCaseId; 25 | } 26 | 27 | public void setTestCaseId(final String testCaseId) { 28 | this.testCaseId = testCaseId; 29 | } 30 | 31 | public String getTestMethod() { 32 | return testMethod; 33 | } 34 | 35 | public void setTestMethod(final String testMethod) { 36 | this.testMethod = testMethod; 37 | } 38 | 39 | public String toString() { 40 | return ("Test Attributes: [ TestCaseId: " + testCaseId) + " ]"; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/webelements/ButtonElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webelements; 15 | 16 | import org.openqa.selenium.By; 17 | import org.openqa.selenium.Keys; 18 | 19 | import com.seleniumtests.core.TestLogging; 20 | import com.seleniumtests.driver.BrowserType; 21 | import com.seleniumtests.driver.WebUIDriver; 22 | 23 | public class ButtonElement extends HtmlElement { 24 | 25 | public ButtonElement(final String label, final By by) { 26 | super(label, by); 27 | } 28 | 29 | @Override 30 | public void click() { 31 | TestLogging.logWebStep("click on " + toHTML(), false); 32 | 33 | BrowserType browser = WebUIDriver.getWebUIDriver().getConfig().getBrowser(); 34 | if (browser == BrowserType.InternetExplore) { 35 | super.sendKeys(Keys.ENTER); 36 | } else { 37 | super.click(); 38 | } 39 | } 40 | 41 | public void submit() { 42 | TestLogging.logWebStep("Submit form by clicking on " + toHTML(), false); 43 | findElement(); 44 | element.submit(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/webelements/CheckBoxElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webelements; 15 | 16 | import org.openqa.selenium.By; 17 | 18 | import com.seleniumtests.core.TestLogging; 19 | 20 | public class CheckBoxElement extends HtmlElement { 21 | 22 | public CheckBoxElement(final String label, final By by) { 23 | super(label, by); 24 | } 25 | 26 | @Override 27 | public void check() { 28 | TestLogging.logWebStep("check " + toHTML(), false); 29 | super.check(); 30 | } 31 | 32 | @Override 33 | public void uncheck() { 34 | TestLogging.logWebStep("uncheck " + toHTML(), false); 35 | super.uncheck(); 36 | } 37 | 38 | @Override 39 | public void click() { 40 | TestLogging.logWebStep("click on " + toHTML(), false); 41 | super.click(); 42 | } 43 | 44 | public boolean isSelected() { 45 | findElement(); 46 | return element.isSelected(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/webelements/IPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webelements; 15 | 16 | public interface IPage { 17 | 18 | String getBodyText(); 19 | 20 | String getHtmlSavedToPath(); 21 | 22 | String getHtmlSource(); 23 | 24 | String getLocation(); 25 | 26 | String getTitle(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/webelements/ImageElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webelements; 15 | 16 | import org.openqa.selenium.By; 17 | 18 | public class ImageElement extends HtmlElement { 19 | 20 | public ImageElement(final String label, final By by) { 21 | super(label, by); 22 | } 23 | 24 | public int getHeight() { 25 | return super.getSize().getHeight(); 26 | } 27 | 28 | public int getWidth() { 29 | return super.getSize().getWidth(); 30 | } 31 | 32 | public String getUrl() { 33 | return super.getAttribute("src"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/webelements/LabelElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webelements; 15 | 16 | import org.openqa.selenium.By; 17 | 18 | import com.seleniumtests.core.CustomAssertion; 19 | import com.seleniumtests.core.TestLogging; 20 | 21 | public class LabelElement extends HtmlElement { 22 | public LabelElement(final String label, final By by) { 23 | super(label, by); 24 | } 25 | 26 | @Override 27 | public String getText() { 28 | TestLogging.logWebStep("get text from " + toHTML(), false); 29 | return super.getText(); 30 | } 31 | 32 | public boolean isTextPresent(final String pattern) { 33 | String text = getText(); 34 | return (text != null && (text.contains(pattern) || text.matches(pattern))); 35 | } 36 | 37 | @Deprecated 38 | public String getExpectedText() { 39 | CustomAssertion.assertTrue(false, "NOT supported!"); 40 | return null; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/webelements/LinkElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webelements; 15 | 16 | import org.openqa.selenium.By; 17 | 18 | import com.seleniumtests.core.TestLogging; 19 | 20 | public class LinkElement extends HtmlElement { 21 | 22 | public LinkElement(final String label, final By by) { 23 | super(label, by); 24 | } 25 | 26 | @Override 27 | public void click() { 28 | TestLogging.logWebStep("click on " + toHTML(), false); 29 | super.click(); 30 | } 31 | 32 | public String getUrl() { 33 | return super.getAttribute("href"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/webelements/RadioButtonElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webelements; 15 | 16 | import org.openqa.selenium.By; 17 | 18 | import com.seleniumtests.core.TestLogging; 19 | 20 | public class RadioButtonElement extends HtmlElement { 21 | 22 | public RadioButtonElement(final String label, final By by) { 23 | super(label, by); 24 | } 25 | 26 | @Override 27 | public void check() { 28 | TestLogging.logWebStep("check " + toHTML(), false); 29 | super.check(); 30 | } 31 | 32 | @Override 33 | public void uncheck() { 34 | TestLogging.logWebStep("uncheck " + toHTML(), false); 35 | super.uncheck(); 36 | } 37 | 38 | @Override 39 | public void click() { 40 | TestLogging.logWebStep("click on " + toHTML(), false); 41 | super.click(); 42 | } 43 | 44 | public boolean isSelected() { 45 | findElement(); 46 | return element.isSelected(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/webelements/Table.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webelements; 15 | 16 | import java.util.List; 17 | 18 | import org.openqa.selenium.By; 19 | import org.openqa.selenium.NotFoundException; 20 | import org.openqa.selenium.WebElement; 21 | 22 | public class Table extends HtmlElement { 23 | private List rows = null; 24 | private List columns = null; 25 | 26 | public Table(final String label, final By by) { 27 | super(label, by); 28 | } 29 | 30 | public void findElement() { 31 | super.findElement(); 32 | try { 33 | rows = element.findElements(By.tagName("tr")); 34 | } catch (NotFoundException e) { } 35 | 36 | } 37 | 38 | public int getColumnCount() { 39 | if (rows == null) { 40 | findElement(); 41 | } 42 | 43 | // Need to check whether rows is null AND whether or not the list of rows is empty 44 | if (rows != null && !rows.isEmpty()) { 45 | try { 46 | columns = rows.get(0).findElements(By.tagName("td")); 47 | } catch (NotFoundException e) { } 48 | 49 | if (columns == null || columns.size() == 0) { 50 | 51 | try { 52 | if (rows.size() > 1) { 53 | columns = rows.get(1).findElements(By.tagName("td")); 54 | } else { 55 | columns = rows.get(0).findElements(By.tagName("th")); 56 | } 57 | } catch (NotFoundException e) { } 58 | } 59 | } 60 | 61 | if (columns != null) { 62 | return columns.size(); 63 | } 64 | 65 | return 0; 66 | } 67 | 68 | public List getColumns() { 69 | return columns; 70 | } 71 | 72 | /** 73 | * Get table cell content. 74 | * 75 | * @param row Starts from 1 76 | * @param column Starts from 1 77 | */ 78 | public String getContent(final int row, final int column) { 79 | if (rows == null) { 80 | findElement(); 81 | } 82 | 83 | if (rows != null && !rows.isEmpty()) { 84 | try { 85 | columns = rows.get(row - 1).findElements(By.tagName("td")); 86 | } catch (NotFoundException e) { } 87 | 88 | if (columns == null || columns.size() == 0) { 89 | try { 90 | columns = rows.get(row - 1).findElements(By.tagName("th")); 91 | } catch (NotFoundException e) { } 92 | } 93 | 94 | return columns.get(column - 1).getText(); 95 | } 96 | 97 | return null; 98 | } 99 | 100 | public int getRowCount() { 101 | if (rows == null) { 102 | findElement(); 103 | } else { 104 | return rows.size(); 105 | } 106 | 107 | int count = element.findElements(By.xpath("tbody/tr")).size(); 108 | if (count == 0) { 109 | count = element.findElements(By.xpath("tr")).size(); 110 | } 111 | 112 | return count; 113 | } 114 | 115 | public List getRows() { 116 | return rows; 117 | } 118 | 119 | public boolean isHasBody() { 120 | return getRows().size() > 0; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/webelements/TextFieldElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webelements; 15 | 16 | import org.openqa.selenium.By; 17 | 18 | import com.seleniumtests.core.TestLogging; 19 | 20 | public class TextFieldElement extends HtmlElement { 21 | public TextFieldElement(final String label, final By by) { 22 | super(label, by); 23 | } 24 | 25 | public void clear() { 26 | TestLogging.logWebStep("Remove data From " + toHTML(), false); 27 | findElement(); 28 | if (!element.getAttribute("type").equalsIgnoreCase("file")) { 29 | element.clear(); 30 | } 31 | } 32 | 33 | public void sendKeys(final CharSequence... keysToSend) { 34 | for(CharSequence charSequence: keysToSend) { 35 | TestLogging.logWebStep("Enter data: \"" + charSequence.toString() + "\" on " + toHTML(), false); 36 | } 37 | findElement(); 38 | element.sendKeys(keysToSend); 39 | } 40 | 41 | public void type(final CharSequence... keysToSend) { 42 | sendKeys(keysToSend); 43 | } 44 | 45 | public void clearAndType(final String keysToSend) { 46 | clear(); 47 | type(keysToSend); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/webelements/WebPageSection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webelements; 15 | 16 | import org.openqa.selenium.By; 17 | import org.openqa.selenium.WebElement; 18 | 19 | import com.seleniumtests.core.TestLogging; 20 | import com.seleniumtests.driver.ScreenShot; 21 | import com.seleniumtests.driver.ScreenshotUtil; 22 | 23 | public abstract class WebPageSection extends BasePage { 24 | 25 | private String name = null; 26 | private String locator = null; 27 | protected WebElement element = null; 28 | private By by = null; 29 | 30 | public WebPageSection(final String name) { 31 | super(); 32 | this.name = name; 33 | } 34 | 35 | public WebPageSection(final String name, final By by) { 36 | super(); 37 | this.name = name; 38 | this.by = by; 39 | } 40 | 41 | /** 42 | * Captures page snapshot. 43 | */ 44 | public void capturePageSnapshot() { 45 | 46 | ScreenShot screenShot = new ScreenshotUtil(driver).captureWebPageSnapshot(); 47 | String title = screenShot.getTitle(); 48 | String url = screenShot.getLocation(); 49 | 50 | TestLogging.logWebOutput(url, title + " (" + TestLogging.buildScreenshotLog(screenShot) + ")", false); 51 | } 52 | 53 | public String getLocator() { 54 | return locator; 55 | } 56 | 57 | public String getName() { 58 | return name; 59 | } 60 | 61 | public By getBy() { 62 | return by; 63 | } 64 | 65 | public boolean isPageSectionPresent() { 66 | return isElementPresent(by); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/xmldog/DifferenceListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.xmldog; 15 | 16 | import org.w3c.dom.Node; 17 | 18 | public interface DifferenceListener { 19 | 20 | void similarNodeFound(Node controlNode, Node testNode, String msg); 21 | 22 | void identicalNodeFound(Node controlNode, Node testNode, String msg); 23 | 24 | void nodeNotFound(Node controlNode, Node testNode, String msg); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/xmldog/NodeDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.xmldog; 15 | 16 | import org.w3c.dom.Node; 17 | 18 | /** 19 | * Class that mimics XMLUnit NodeDetail class. Primarily used 20 | * 21 | *

to store the details about the Node being compared 22 | */ 23 | 24 | public class NodeDetail { 25 | 26 | private Node _node = null; 27 | 28 | private String _xpath = null; 29 | 30 | private String _value = null; 31 | 32 | /** 33 | * Constructor. 34 | */ 35 | 36 | public NodeDetail() { } 37 | 38 | /** 39 | * Constructor. 40 | * 41 | * @param node the Document Node 42 | * 43 | * @paran xpath the XPath location of the Node 44 | */ 45 | 46 | public NodeDetail(final Node node, final String xpath) { 47 | 48 | _node = node; 49 | 50 | _xpath = xpath; 51 | 52 | } 53 | 54 | /** 55 | * Constructor. 56 | * 57 | * @param value the value of the Node 58 | * @param node the Document Node 59 | * 60 | * @paran xpath the XPath location of the Node 61 | */ 62 | 63 | public NodeDetail(final String value, final Node node, final String xpath) { 64 | 65 | _value = value; 66 | 67 | _node = node; 68 | 69 | _xpath = xpath; 70 | 71 | } 72 | 73 | /** 74 | * Gets the Node. 75 | * 76 | * @return the Document Node 77 | */ 78 | 79 | public Node getNode() { 80 | 81 | return _node; 82 | 83 | } 84 | 85 | /** 86 | * Sets the Node. 87 | * 88 | * @param node the Document Node 89 | */ 90 | 91 | public void setNode(final Node node) { 92 | 93 | _node = node; 94 | 95 | } 96 | 97 | /** 98 | * Gets XPath expression for the Node. 99 | * 100 | * @return the XPath expression for the Node 101 | */ 102 | 103 | public String getXPathLocation() { 104 | 105 | return _xpath; 106 | 107 | } 108 | 109 | /** 110 | * Sets XPath expression for the Node. 111 | * 112 | * @param xpath the XPath expression for the Node 113 | */ 114 | 115 | public void setXPathLocation(final String xpath) { 116 | 117 | _xpath = xpath; 118 | 119 | } 120 | 121 | /** 122 | * Gets the value of the Node. 123 | * 124 | * @return the Node value 125 | */ 126 | 127 | public String getValue() { 128 | 129 | if (_value == null) { 130 | 131 | return getNode().getNodeValue(); 132 | } 133 | 134 | return _value; 135 | 136 | } 137 | 138 | } 139 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/xmldog/StringUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.xmldog; 15 | 16 | import java.util.UUID; 17 | 18 | public class StringUtil { 19 | 20 | /** 21 | * Checks if the input String is Whitespace only. 22 | */ 23 | 24 | public static boolean isWhitespaceStr(String str) { 25 | 26 | if (str == null) { 27 | 28 | return false; 29 | } 30 | 31 | str = str.trim(); 32 | 33 | for (int i = 0; i < str.length(); i++) { 34 | 35 | if (!Character.isWhitespace(str.charAt(i))) { 36 | 37 | return false; 38 | } 39 | 40 | } 41 | 42 | return true; 43 | 44 | } 45 | 46 | /** 47 | * Gets Platform independent line separator (new line character(s). 48 | */ 49 | 50 | public static String getNewlineStr() { 51 | 52 | return System.getProperty("line.separator"); 53 | 54 | } 55 | 56 | public static String generateRandomString(boolean... split) { 57 | if(split.length>0) { 58 | return UUID.randomUUID().toString().split("-")[0]; 59 | } else { 60 | return UUID.randomUUID().toString(); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/xmldog/XMLConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.xmldog; 15 | 16 | /** 17 | * To change this generated comment edit the template variable "typecomment": Window>Preferences>Java>Templates. To 18 | * enable and disable the creation of type comments go to Window>Preferences>Java>Code Generation. 19 | */ 20 | 21 | /** 22 | * A convenient place to hang constants relating to general XML usage. 23 | */ 24 | 25 | public interface XMLConstants { 26 | 27 | /** 28 | * <?xml&greaterThan; declaration. 29 | */ 30 | 31 | String XML_DECLARATION = 32 | 33 | ""; 34 | 35 | /** 36 | * xmlns attribute prefix. 37 | */ 38 | 39 | String XMLNS_PREFIX = "xmlns"; 40 | 41 | /** 42 | * "<" 43 | */ 44 | 45 | String OPEN_START_NODE = "<"; 46 | 47 | /** 48 | * "</" 49 | */ 50 | 51 | String OPEN_END_NODE = ""; 58 | 59 | /** 60 | * "![CDATA[" 61 | */ 62 | 63 | String START_CDATA = "![CDATA["; 64 | 65 | /** 66 | * "]]" 67 | */ 68 | 69 | String END_CDATA = "]]"; 70 | 71 | /** 72 | * "!--" 73 | */ 74 | 75 | String START_COMMENT = "!--"; 76 | 77 | /** 78 | * "--"" 79 | */ 80 | 81 | String END_COMMENT = "--"; 82 | 83 | /** 84 | * "?" 85 | */ 86 | 87 | String START_PROCESSING_INSTRUCTION = "?"; 88 | 89 | /** 90 | * "?" 91 | */ 92 | 93 | String END_PROCESSING_INSTRUCTION = "?"; 94 | 95 | /** 96 | * "!DOCTYPE" 97 | */ 98 | 99 | String START_DOCTYPE = "!DOCTYPE "; 100 | 101 | /** 102 | * "/" 103 | */ 104 | 105 | String XPATH_SEPARATOR = "/"; 106 | 107 | /** 108 | * "[" 109 | */ 110 | 111 | String XPATH_NODE_INDEX_START = "["; 112 | 113 | /** 114 | * "]" 115 | */ 116 | 117 | String XPATH_NODE_INDEX_END = "]"; 118 | 119 | /** 120 | * "comment()" 121 | */ 122 | 123 | String XPATH_COMMENT_IDENTIFIER = "comment()"; 124 | 125 | /** 126 | * "processing-instruction()" 127 | */ 128 | 129 | String XPATH_PROCESSING_INSTRUCTION_IDENTIFIER = "processing-instruction()"; 130 | 131 | /** 132 | * "text()" 133 | */ 134 | 135 | String XPATH_CHARACTER_NODE_IDENTIFIER = "text()"; 136 | 137 | /** 138 | * "&at;" 139 | */ 140 | 141 | String XPATH_ATTRIBUTE_IDENTIFIER = "@"; 142 | 143 | /** 144 | * Regular Expression startor for Exclusion List. 145 | */ 146 | 147 | String XPATH_REGEX_BEGIN = "["; 148 | 149 | /** 150 | * Regular Expression terminator for Exclusion List. 151 | */ 152 | 153 | String XPATH_REGEX_END = "]"; 154 | 155 | } 156 | -------------------------------------------------------------------------------- /src/main/java/com/seleniumtests/xmldog/XMLDogConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.xmldog; 15 | 16 | /** 17 | * XMLDogConstants.java. To change this generated comment edit the template variable "typecomment": 18 | * Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to 19 | * Window>Preferences>Java>Code Generation. $Id$ 20 | */ 21 | 22 | /** 23 | * XMLDogConstants Interface containing all the XMLDog Application constants. 24 | */ 25 | 26 | public interface XMLDogConstants { 27 | 28 | // Application name 29 | 30 | String APP_NAME = "XMLDog"; 31 | 32 | // DEBUG flag 33 | 34 | boolean DEBUG = false; 35 | 36 | // Event types sent to the DifferenceListeners 37 | 38 | int EVENT_NODE_IDENTICAL = 0; 39 | 40 | int EVENT_NODE_SIMILAR = 1; 41 | 42 | int EVENT_NODE_MISMATCH = 2; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/resources/reporter/css/jquery.lightbox-0.5.css: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery lightBox plugin 3 | * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/) 4 | * and adapted to me for use like a plugin from jQuery. 5 | * @name jquery-lightbox-0.5.css 6 | * @author Leandro Vieira Pinho - http://leandrovieira.com 7 | * @version 0.5 8 | * @date April 11, 2008 9 | * @category jQuery plugin 10 | * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com) 11 | * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US 12 | * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin 13 | */ 14 | #jquery-overlay { 15 | position: absolute; 16 | top: 0; 17 | left: 0; 18 | z-index: 90; 19 | width: 100%; 20 | height: 500px; 21 | } 22 | #jquery-lightbox { 23 | position: absolute; 24 | top: 0; 25 | left: 0; 26 | width: 100%; 27 | z-index: 100; 28 | text-align: center; 29 | line-height: 0; 30 | } 31 | #jquery-lightbox a img { border: none; } 32 | #lightbox-container-image-box { 33 | position: relative; 34 | background-color: #fff; 35 | width: 250px; 36 | height: 250px; 37 | margin: 0 auto; 38 | } 39 | #lightbox-container-image { padding: 10px; } 40 | #lightbox-loading { 41 | position: absolute; 42 | top: 40%; 43 | left: 0%; 44 | height: 25%; 45 | width: 100%; 46 | text-align: center; 47 | line-height: 0; 48 | } 49 | #lightbox-nav { 50 | position: absolute; 51 | top: 0; 52 | left: 0; 53 | height: 100%; 54 | width: 100%; 55 | z-index: 10; 56 | } 57 | #lightbox-container-image-box > #lightbox-nav { left: 0; } 58 | #lightbox-nav a { outline: none;} 59 | #lightbox-nav-btnPrev, #lightbox-nav-btnNext { 60 | width: 49%; 61 | height: 100%; 62 | zoom: 1; 63 | display: block; 64 | } 65 | #lightbox-nav-btnPrev { 66 | left: 0; 67 | float: left; 68 | } 69 | #lightbox-nav-btnNext { 70 | right: 0; 71 | float: right; 72 | } 73 | #lightbox-container-image-data-box { 74 | font: 10px Verdana, Helvetica, sans-serif; 75 | background-color: silver; 76 | margin: 0 auto; 77 | line-height: 1.4em; 78 | overflow: auto; 79 | width: 100%; 80 | padding: 0 10px 0; 81 | } 82 | #lightbox-container-image-data { 83 | padding: 0 10px; 84 | color: #666; 85 | } 86 | #lightbox-container-image-data #lightbox-image-details { 87 | width: 90%; 88 | float: left; 89 | text-align: left; 90 | } 91 | #lightbox-image-details-caption { font-weight: bold; } 92 | #lightbox-image-details-currentNumber { 93 | display: block; 94 | clear: left; 95 | } 96 | #lightbox-secNav-btnClose { 97 | width: 66px; 98 | float: right; 99 | padding-top: 0.3em; 100 | padding-bottom: 0.3em; 101 | } 102 | .filmStrip { 103 | background-color: 999999; 104 | padding: 10px; 105 | } 106 | .filmStrip ul { list-style: none; } 107 | .filmStrip ul li { display: inline; } 108 | .filmStrip ul img { 109 | border: 5px solid #3e3e3e; 110 | border-width: 5px 5px 20px; 111 | } 112 | .filmStrip ul a:hover img { 113 | border: 5px solid #fff; 114 | border-width: 5px 5px 20px; 115 | color: #fff; 116 | } 117 | .filmStrip ul a:hover { color: #fff; } 118 | 119 | 120 | .top { 121 | background-color: 999999; 122 | } 123 | 124 | .top a { 125 | margin-left: 50px; 126 | } 127 | 128 | .summary { 129 | padding: 10px; 130 | } 131 | 132 | .summary p { 133 | font-weight: bold; 134 | font-size: 20; 135 | text-align: center; 136 | } 137 | 138 | body{ 139 | background-color: 999999; 140 | } 141 | 142 | -------------------------------------------------------------------------------- /src/main/resources/reporter/css/mktree.css: -------------------------------------------------------------------------------- 1 | /* Put this inside a @media qualifier so Netscape 4 ignores it */ 2 | @media screen , print { /* Turn off list bullets */ 3 | ul.mktree li { 4 | list-style: none; 5 | } 6 | /* Control how "spaced out" the tree is */ 7 | ul.mktree,ul.mktree ul,ul.mktree li { 8 | margin-left: 10px; 9 | padding: 0px; 10 | } 11 | /* Provide space for our own "bullet" inside the LI */ 12 | ul.mktree li .bullet { 13 | padding-left: 15px; 14 | } 15 | /* Show "bullets" in the links, depending on the class of the LI that the link's in */ 16 | ul.mktree li.liOpen .bullet { 17 | cursor: pointer; 18 | background: url(../images/mktree/seleniumtests_minus.gif) center left no-repeat; 19 | } 20 | ul.mktree li.liClosed .bullet { 21 | cursor: pointer; 22 | background: url(../images/mktree/seleniumtests_plus.gif) center left no-repeat; 23 | } 24 | ul.mktree li.liBullet .bullet { 25 | cursor: default; 26 | background: url(../images/mktree/seleniumtests_bullet.gif) center left no-repeat; 27 | } 28 | /* Sublists are visible or not based on class of parent LI */ 29 | ul.mktree li.liOpen ul { 30 | display: block; 31 | } 32 | ul.mktree li.liClosed ul { 33 | display: none; 34 | } 35 | /* Format menu items differently depending on what level of the tree they are in */ 36 | /* Uncomment this if you want your fonts to decrease in size the deeper they are in the tree */ 37 | /* 38 | ul.mktree li ul li { font-size: 90% } 39 | */ 40 | } -------------------------------------------------------------------------------- /src/main/resources/reporter/images/lightbox/seleniumtests_lightbox-blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/lightbox/seleniumtests_lightbox-blank.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/lightbox/seleniumtests_lightbox-btn-close.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/lightbox/seleniumtests_lightbox-btn-close.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/lightbox/seleniumtests_lightbox-btn-next.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/lightbox/seleniumtests_lightbox-btn-next.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/lightbox/seleniumtests_lightbox-btn-prev.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/lightbox/seleniumtests_lightbox-btn-prev.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/lightbox/seleniumtests_lightbox-ico-loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/lightbox/seleniumtests_lightbox-ico-loading.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/ff.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/ff.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/ffgrey.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/ffgrey.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/firefox16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/firefox16.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/imgLoading_sm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/imgLoading_sm.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/loadeing_esm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/loadeing_esm.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/loading.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/loading_sm_non.GIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/loading_sm_non.GIF -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/loading_smgif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/loading_smgif.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/passed_sm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/passed_sm.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/selenium-grid-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/selenium-grid-logo.png -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/seleniumtests_bullet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/seleniumtests_bullet.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/seleniumtests_failed_sm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/seleniumtests_failed_sm.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/seleniumtests_minus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/seleniumtests_minus.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/seleniumtests_plus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/seleniumtests_plus.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/seleniumtests_test1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/seleniumtests_test1.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/seleniumtests_test2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/seleniumtests_test2.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/seleniumtests_test3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/seleniumtests_test3.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/skipped.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/skipped.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/testng.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/testng.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/mktree/wait16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/mktree/wait16.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/yukontoolbox/seleniumtests_footer_grad.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/yukontoolbox/seleniumtests_footer_grad.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/yukontoolbox/seleniumtests_grey_bl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/yukontoolbox/seleniumtests_grey_bl.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/yukontoolbox/seleniumtests_grey_br.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/yukontoolbox/seleniumtests_grey_br.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/yukontoolbox/seleniumtests_hovertab_l.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/yukontoolbox/seleniumtests_hovertab_l.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/yukontoolbox/seleniumtests_hovertab_r.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/yukontoolbox/seleniumtests_hovertab_r.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/yukontoolbox/seleniumtests_tabbed_nav_goldgradbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/yukontoolbox/seleniumtests_tabbed_nav_goldgradbg.png -------------------------------------------------------------------------------- /src/main/resources/reporter/images/yukontoolbox/seleniumtests_table_sep_left.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/yukontoolbox/seleniumtests_table_sep_left.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/yukontoolbox/seleniumtests_table_sep_right.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/yukontoolbox/seleniumtests_table_sep_right.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/yukontoolbox/seleniumtests_table_zebrastripe_left.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/yukontoolbox/seleniumtests_table_zebrastripe_left.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/yukontoolbox/seleniumtests_table_zebrastripe_right.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/yukontoolbox/seleniumtests_table_zebrastripe_right.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/images/yukontoolbox/seleniumtests_yellow_tr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/main/resources/reporter/images/yukontoolbox/seleniumtests_yellow_tr.gif -------------------------------------------------------------------------------- /src/main/resources/reporter/js/report.js: -------------------------------------------------------------------------------- 1 | function copyFile(sourceFile, descFile) { 2 | if (browserVersion.isIE) { 3 | var fso = new ActiveXObject("Scripting.FileSystemObject"); 4 | fso.CopyFile(sourceFile, descFile); 5 | } else { 6 | alert("Currenlty this function only supports Internet Explorer"); 7 | } 8 | } 9 | 10 | function toggle(divId) { 11 | var ele = document.getElementById(divId); 12 | if (ele.style.display == "block") { 13 | ele.style.display = "none"; 14 | } else { 15 | ele.style.display = "block"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/templates/report.part.singlePageError.html: -------------------------------------------------------------------------------- 1 |

2 |
3 |
4 |
5 |
6 |
7 |

$pageName

8 | 9 |
10 | $content 11 |
12 | 13 | 18 |
19 | 20 | -------------------------------------------------------------------------------- /src/main/resources/templates/report.part.singleTest.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |

$methodName

8 |

$desc

9 | 10 |
11 | $content 12 |
13 | 14 | 19 |
-------------------------------------------------------------------------------- /src/main/resources/templates/report.part.summary.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 |
6 |
7 |
8 |

$suiteName

9 | 10 | 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 | #set( $odd = 1 ) 63 | #foreach( $miniTestResult in $tests ) 64 | #if ( $odd==1 ) 65 | 66 | #set($odd=0) 67 | #else 68 | 69 | #set($odd=1) 70 | #end 71 | 73 | 74 | 75 | 76 | 77 | 78 | #end 79 | #if ( $odd==1 ) 80 | 81 | #else 82 | 83 | #end 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 |
Tests in Test Suite:Method CountPassed Tests CountFailed Tests CountSkipped Tests Count
Test Execution Time : $totalRunTime.
----------------------------------------------
Test Execution Date : $TimeStamp
$miniTestResult.getName() 72 | $miniTestResult.getTotalMethod()$miniTestResult.getInstancesPassed()$miniTestResult.getInstancesFailed()$miniTestResult.getInstancesSkipped()
Total$total.getTotalMethod()$total.getInstancesPassed()$total.getInstancesFailed()$total.getInstancesSkipped()
94 | 95 | 96 | 97 | 98 |
99 |
100 |
101 |
102 | 103 |
104 | 105 |
-------------------------------------------------------------------------------- /src/main/resources/templates/report.part.testDetail.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/templates/screenshotHTMLPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | 9 | 107 | 108 | 109 | 110 | 111 |
page url : $pageUrl
112 | message : $message
113 |
114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 |
screenshotsourcesourceRendered
122 | 123 |
124 | 125 | 126 |
source is here : $sourcelink 127 |
$source
128 |
129 | 130 | 131 |
WARNING : this is a the preview of the 132 | html only.The html uses some dynamic includes 133 | Those files might have changed since the test was ran. Refer to the 134 | screenshot to have what the page really looked like. 135 | 136 |
137 | 138 |
139 | 140 | 141 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/dataobject/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.dataobject; 15 | 16 | /** 17 | * User account object for TestLink. 18 | */ 19 | public class User { 20 | 21 | private String firstName; 22 | private String lastName; 23 | private String userName; 24 | private String password; 25 | 26 | public String getFirstName() { 27 | return firstName; 28 | } 29 | 30 | public String getLastName() { 31 | return lastName; 32 | } 33 | 34 | public void setFirstName(final String firstName) { 35 | this.firstName = firstName; 36 | } 37 | 38 | public void setLastName(final String lastName) { 39 | this.lastName = lastName; 40 | } 41 | 42 | public String getUserName() { 43 | return userName; 44 | } 45 | 46 | public void setUserName(String userName) { 47 | this.userName = userName; 48 | } 49 | 50 | public String getPassword() { 51 | return password; 52 | } 53 | 54 | public void setPassword(String password) { 55 | this.password = password; 56 | } 57 | 58 | @Override public String toString() { 59 | StringBuilder stringBuilder = new StringBuilder(); 60 | 61 | return stringBuilder.append("User [firstName = " + firstName + ", ") 62 | .append("lastName = " + lastName + ",").append("userName = " + 63 | userName + ",").append("password " + password + "]").toString(); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/tests/AndroidAppTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.tests; 15 | 16 | import static com.seleniumtests.core.CustomAssertion.assertThat; 17 | import static org.hamcrest.CoreMatchers.is; 18 | 19 | import org.testng.annotations.Test; 20 | 21 | import com.seleniumtests.core.SeleniumTestPlan; 22 | import com.seleniumtests.webpage.CalculatorScreen; 23 | 24 | /** 25 | * Android app test suite. 26 | */ 27 | public class AndroidAppTest extends SeleniumTestPlan { 28 | 29 | /** 30 | * Adds two numbers using calculator program. 31 | */ 32 | @Test(groups = {"addTwoNumbers"}, description = "Adds two numbers using calculator program") 33 | public void addTwoNumbers() throws Exception { 34 | 35 | CalculatorScreen calculatorScreen = new CalculatorScreen(true); 36 | String result = calculatorScreen.clickSymbol("2").clickSymbol("+").clickSymbol("4").clickSymbol("=") 37 | .getResultText(); 38 | assertThat(result, is("6")); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/tests/AndroidWebTest.java: -------------------------------------------------------------------------------- 1 | package com.seleniumtests.tests; 2 | 3 | import org.testng.annotations.Test; 4 | 5 | import com.seleniumtests.core.SeleniumTestPlan; 6 | import com.seleniumtests.webpage.RegistrationPage; 7 | 8 | public class AndroidWebTest extends SeleniumTestPlan { 9 | 10 | @Test() 11 | public void testMobileWeb() throws Exception { 12 | RegistrationPage registrationPage = new RegistrationPage(true); 13 | assert registrationPage.getTitle().equals("Test Registration Page") : "unable to launch Webdriver forum"; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/tests/IOSAppTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.tests; 15 | 16 | import static com.seleniumtests.core.CustomAssertion.assertThat; 17 | import static org.hamcrest.CoreMatchers.equalTo; 18 | import static org.hamcrest.CoreMatchers.is; 19 | 20 | import org.testng.annotations.Test; 21 | 22 | import com.seleniumtests.core.SeleniumTestPlan; 23 | import com.seleniumtests.webpage.UICatalogScreen; 24 | 25 | /** 26 | * iOS app test suite. 27 | */ 28 | public class IOSAppTest extends SeleniumTestPlan { 29 | 30 | @Test(groups = {"verifyUICatalogScreen"}, description = "Verifies UI Catalog screen") 31 | public void verifyUICatalogScreen() throws Exception { 32 | 33 | UICatalogScreen uiCatalogScree = new UICatalogScreen(true); 34 | 35 | uiCatalogScree.clickSymbol("TextFields"); 36 | assertThat("UI Text Field is missing", UICatalogScreen.isUITextFieldDisplayed(), is(equalTo(true))); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/tests/JSErrorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.tests; 15 | 16 | import org.testng.annotations.Test; 17 | 18 | import com.seleniumtests.core.SeleniumTestPlan; 19 | import com.seleniumtests.webpage.JSErrorPage; 20 | 21 | 22 | public class JSErrorTest extends SeleniumTestPlan { 23 | 24 | @Test(groups = {"jsErrorTest"}, 25 | description = "jsErrorTest") 26 | public void jsErrorTest() throws Exception { 27 | 28 | new JSErrorPage(true); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/tests/RegistrationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.tests; 15 | 16 | import static com.seleniumtests.core.CustomAssertion.assertThat; 17 | import static org.hamcrest.CoreMatchers.is; 18 | 19 | import java.lang.reflect.Method; 20 | import java.util.Iterator; 21 | import java.util.LinkedHashMap; 22 | 23 | import org.testng.annotations.DataProvider; 24 | import org.testng.annotations.Test; 25 | 26 | import com.seleniumtests.core.Filter; 27 | import com.seleniumtests.core.SeleniumTestPlan; 28 | import com.seleniumtests.dataobject.User; 29 | import com.seleniumtests.util.SpreadSheetHelper; 30 | import com.seleniumtests.util.internal.entity.TestEntity; 31 | import com.seleniumtests.webpage.GoogleHomePage; 32 | import com.seleniumtests.webpage.LoginPage; 33 | import com.seleniumtests.webpage.RegistrationPage; 34 | 35 | 36 | public class RegistrationTest extends SeleniumTestPlan { 37 | 38 | @DataProvider( 39 | name = "loginData", 40 | parallel = true 41 | ) 42 | public static Iterator getUserInfo(final Method m) 43 | throws Exception { 44 | Filter filter = Filter.equalsIgnoreCase(TestEntity.TEST_METHOD, 45 | m.getName()); 46 | 47 | LinkedHashMap> classMap = 48 | new LinkedHashMap>(); 49 | classMap.put("TestEntity", TestEntity.class); 50 | classMap.put("User", User.class); 51 | 52 | return SpreadSheetHelper.getEntitiesFromSpreadsheet( 53 | RegistrationTest.class, classMap, "loginuser.csv", filter); 54 | } 55 | 56 | @Test( 57 | groups = { "registerWithValidUserData" }, 58 | dataProvider = "loginData", 59 | description = "Register with valid login data" 60 | ) 61 | public void registerWithValidUserData(final TestEntity testEntity, 62 | final User user) throws Exception { 63 | 64 | new RegistrationPage(true).submitValidRegistrationData(user); 65 | assertThat("User Name text box is missing on Login Page!!!", 66 | LoginPage.isUserNameDisplayed(), is(true)); 67 | 68 | } 69 | 70 | @Test( 71 | groups = { "registerWithInvalidUserData" }, 72 | dataProvider = "loginData", 73 | description = "Register with Invalid login data" 74 | ) 75 | public void registerWithInvalidUserData(final TestEntity testEntity, 76 | final User user) throws Exception { 77 | RegistrationPage registrationPage = new RegistrationPage(true); 78 | registrationPage.enterFirstName(user.getFirstName()).enterLastName( 79 | user.getLastName()).enterUserName(user.getUserName()).enterPassword( 80 | user.getPassword()); 81 | assertThat( 82 | "User Name text box is shown despite not completing registration process!!!", 83 | LoginPage.isUserNameDisplayed(), is(true)); 84 | 85 | } 86 | 87 | @Test( 88 | groups = { "loginTest" }, 89 | dataProvider = "loginData", 90 | description = 91 | "Login test to verify that google home page can be reached" 92 | ) 93 | public void loginTest(final TestEntity testEntity, final User user) 94 | throws Exception { 95 | 96 | GoogleHomePage googleHomePage = new RegistrationPage(true) 97 | .submitValidRegistrationData(user).enterLoginData(user); 98 | 99 | assertThat("Google home page is not displayed after login", 100 | googleHomePage.isSearchBoxDisplayed(), is(true)); 101 | 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/tests/RetryTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.tests; 15 | 16 | import org.testng.Assert; 17 | import org.testng.annotations.Test; 18 | 19 | import com.seleniumtests.core.CustomAssertion; 20 | import com.seleniumtests.core.SeleniumTestPlan; 21 | 22 | /** 23 | * Using Matchers. 24 | */ 25 | public class RetryTest extends SeleniumTestPlan { 26 | 27 | @Test 28 | public void retryFailedTest() { 29 | CustomAssertion.assertThat("Soft failure", false); 30 | CustomAssertion.assertThat("Soft failure 2, executed despite first failure", false); 31 | CustomAssertion.assertThat("This never fails", true); 32 | CustomAssertion.assertThat("This fails again", false); 33 | // with out assertion check, soft failures would not be caught 34 | assert CustomAssertion.getVerificationFailures().isEmpty():"Verification Errors"; 35 | } 36 | 37 | private int count = 0; 38 | 39 | @Test 40 | public void test() { 41 | count++; 42 | if (count % 3 != 0) { 43 | Assert.fail("Injected Failure"); 44 | } 45 | count = 0; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/tests/RetryTest1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.tests; 15 | 16 | import org.testng.Assert; 17 | import org.testng.annotations.Test; 18 | 19 | import com.seleniumtests.core.CustomAssertion; 20 | import com.seleniumtests.core.SeleniumTestPlan; 21 | 22 | /** 23 | * Using Matchers. 24 | */ 25 | public class RetryTest1 extends SeleniumTestPlan { 26 | 27 | @Test(groups = "retryFailedTest") 28 | public void retryFailedTest() { 29 | assert false:"this fails"; 30 | // CustomAssertion.assertThat("Soft failure", false); 31 | /* 32 | CustomAssertion.assertThat("Soft failure 2, executed despite first failure", false); 33 | CustomAssertion.assertThat("This never fails", true); 34 | CustomAssertion.assertThat("This fails again", false); 35 | */ 36 | // with out assertion check, soft failures would not be caught 37 | assert CustomAssertion.getVerificationFailures().isEmpty():"Verification Errors"; 38 | } 39 | 40 | @Test(groups = "retryFailedTest11") 41 | public void retryFailedTest11() { 42 | assert false : "this fails"; 43 | } 44 | 45 | private int count = 0; 46 | 47 | public void test() { 48 | count++; 49 | if (count % 3 != 0) { 50 | Assert.fail("Injected Failure"); 51 | } 52 | count = 0; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/tests/RetryTest2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.tests; 15 | 16 | import org.testng.Assert; 17 | import org.testng.annotations.Test; 18 | 19 | import com.seleniumtests.core.CustomAssertion; 20 | import com.seleniumtests.core.SeleniumTestPlan; 21 | 22 | /** 23 | * Using Matchers. 24 | */ 25 | public class RetryTest2 extends SeleniumTestPlan { 26 | 27 | @Test 28 | public void retryFailedTest() { 29 | CustomAssertion.assertThat("Soft failure", false); 30 | CustomAssertion.assertThat("Soft failure 2, executed despite first failure", false); 31 | CustomAssertion.assertThat("This never fails", true); 32 | CustomAssertion.assertThat("This fails again", false); 33 | // with out assertion check, soft failures would not be caught 34 | assert CustomAssertion.getVerificationFailures().isEmpty():"Verification Errors"; 35 | } 36 | 37 | @Test(groups = "retryFailedTest22") 38 | public void retryFailedTest22() { 39 | assert false : "this fails"; 40 | } 41 | 42 | 43 | private int count = 0; 44 | 45 | @Test 46 | public void test() { 47 | count++; 48 | if (count % 3 != 0) { 49 | Assert.fail("Injected Failure"); 50 | } 51 | count = 0; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/tests/RetryTest3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.tests; 15 | 16 | import org.testng.Assert; 17 | import org.testng.annotations.Test; 18 | 19 | import com.seleniumtests.core.CustomAssertion; 20 | import com.seleniumtests.core.SeleniumTestPlan; 21 | 22 | /** 23 | * Using Matchers. 24 | */ 25 | public class RetryTest3 extends SeleniumTestPlan { 26 | 27 | @Test 28 | public void retryFailedTest() { 29 | CustomAssertion.assertThat("Soft failure", false); 30 | CustomAssertion.assertThat("Soft failure 2, executed despite first failure", false); 31 | CustomAssertion.assertThat("This never fails", true); 32 | CustomAssertion.assertThat("This fails again", false); 33 | // with out assertion check, soft failures would not be caught 34 | assert CustomAssertion.getVerificationFailures().isEmpty():"Verification Errors"; 35 | } 36 | 37 | private int count = 0; 38 | 39 | @Test 40 | public void test() { 41 | count++; 42 | if (count % 3 != 0) { 43 | Assert.fail("Injected Failure"); 44 | } 45 | count = 0; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/tests/SauceLabsTest.java: -------------------------------------------------------------------------------- 1 | package com.seleniumtests.tests; 2 | 3 | 4 | import com.seleniumtests.core.SeleniumTestPlan; 5 | 6 | import com.seleniumtests.webpage.SauceLabsPage; 7 | 8 | import org.testng.annotations.Test; 9 | 10 | 11 | public class SauceLabsTest extends SeleniumTestPlan { 12 | 13 | public SauceLabsTest() throws Exception { 14 | } 15 | 16 | @Test(groups = "sauce") 17 | public void sauceLabsTest() throws Exception { 18 | SauceLabsPage sauceLabsPage = new SauceLabsPage(true); 19 | sauceLabsPage.getMeToTheSauceLabs(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/tests/SoftAssertionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.tests; 15 | 16 | import static com.seleniumtests.core.CustomAssertion.assertEquals; 17 | import static com.seleniumtests.core.CustomAssertion.assertThat; 18 | import static com.seleniumtests.core.CustomAssertion.assertTrue; 19 | import static org.hamcrest.CoreMatchers.is; 20 | 21 | import org.testng.annotations.Test; 22 | 23 | import com.seleniumtests.core.CustomAssertion; 24 | import com.seleniumtests.core.SeleniumTestPlan; 25 | import com.seleniumtests.core.TestLogging; 26 | 27 | /** 28 | * Demonstrate test execution continues even though assertions fail. 29 | * 30 | *

Date: 10/2/13 Time: 4:59 PM 31 | */ 32 | public class SoftAssertionTest extends SeleniumTestPlan { 33 | 34 | /** 35 | * Continues with test execution even though assertions fail. 36 | */ 37 | @Test(groups = "softAssertionTest", description = "Continues with test execution even though assertions fail") 38 | public void softAssertionTest() { 39 | assertThat("selenium", is("selenium")); 40 | assertEquals(true, false, "boolean test failure"); 41 | assertTrue(false, "another boolean test failure"); 42 | assertEquals("selenium", "qtp", "universal test failure :)"); 43 | assertTrue(1 == 1, "never fails"); 44 | TestLogging.log( 45 | "This message is logged after initial assertion failures. Hence test execution continues even in the wake of test failures"); 46 | // With out asserting verification failures, test would not be marked as fail 47 | assert CustomAssertion.getVerificationFailures().isEmpty():"Verification Errors"; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/webpage/CalculatorScreen.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webpage; 15 | 16 | import org.openqa.selenium.By; 17 | 18 | import com.seleniumtests.core.SeleniumTestsContextManager; 19 | import com.seleniumtests.webelements.ButtonElement; 20 | import com.seleniumtests.webelements.LabelElement; 21 | import com.seleniumtests.webelements.PageObject; 22 | 23 | /** 24 | * Defines service for Calculator screen. 25 | */ 26 | public class CalculatorScreen extends PageObject { 27 | 28 | public CalculatorScreen() throws Exception { } 29 | 30 | /** 31 | * Opens log in page. 32 | * 33 | * @param openAPP 34 | * 35 | * @throws Exception 36 | */ 37 | public CalculatorScreen(final boolean openAPP) throws Exception { 38 | super(null, openAPP ? SeleniumTestsContextManager.getThreadContext().getApp() : null); 39 | } 40 | 41 | public ButtonElement getSymbolElement(final String symbol) { 42 | return new ButtonElement("Button Element", By.name(symbol)); 43 | } 44 | 45 | public CalculatorScreen clickSymbol(final String symbol) { 46 | getSymbolElement(symbol).click(); 47 | return this; 48 | } 49 | 50 | public String getResultText() { 51 | 52 | // You can also locate this element using class name - By.className("android.widget.EditText")) 53 | return new LabelElement("Result Text", By.id("com.android.calculator2:id/formula")).getText(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/webpage/GoogleHomePage.java: -------------------------------------------------------------------------------- 1 | package com.seleniumtests.webpage; 2 | 3 | import com.seleniumtests.core.Locator; 4 | 5 | import com.seleniumtests.webelements.PageObject; 6 | import com.seleniumtests.webelements.TextFieldElement; 7 | 8 | /** 9 | * Created by tarun on 3/22/16. 10 | */ 11 | public class GoogleHomePage extends PageObject { 12 | 13 | private static final TextFieldElement searchTextBox = new TextFieldElement("search Text Box", 14 | Locator.locateByName("q")); 15 | 16 | public GoogleHomePage() throws Exception { 17 | super(searchTextBox); 18 | } 19 | 20 | public boolean isSearchBoxDisplayed() { 21 | return searchTextBox.isDisplayed(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/webpage/JSErrorPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webpage; 15 | 16 | import com.seleniumtests.core.SeleniumTestsContextManager; 17 | import com.seleniumtests.webelements.PageObject; 18 | 19 | /** 20 | * Provides services offered by Registration Page. 21 | * 22 | *

Date: 10/2/13 Time: 6:26 PM 23 | */ 24 | public class JSErrorPage extends PageObject { 25 | 26 | public JSErrorPage(final boolean openPageURL) throws Exception { 27 | super(null, openPageURL ? SeleniumTestsContextManager.getThreadContext().getAppURL() : 28 | null); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/webpage/LoginPage.java: -------------------------------------------------------------------------------- 1 | package com.seleniumtests.webpage; 2 | 3 | import static com.seleniumtests.core.Locator.locateByCSSSelector; 4 | import static com.seleniumtests.core.Locator.locateByName; 5 | 6 | import com.seleniumtests.dataobject.User; 7 | 8 | import com.seleniumtests.webelements.ButtonElement; 9 | import com.seleniumtests.webelements.PageObject; 10 | import com.seleniumtests.webelements.TextFieldElement; 11 | 12 | /** 13 | * Created by tarun on 3/22/16. 14 | */ 15 | public class LoginPage extends PageObject { 16 | 17 | private static final TextFieldElement userNameTextBox = new TextFieldElement("Username Textbox", 18 | locateByName("usernameLoginPage")); 19 | 20 | private static final TextFieldElement passwordTextBox = new TextFieldElement("Password Textbox", 21 | locateByName("psw1")); 22 | 23 | private ButtonElement submitButton = new ButtonElement("submit Button", 24 | locateByCSSSelector("input~input[value='Submit']")); 25 | 26 | public LoginPage() throws Exception { 27 | super(userNameTextBox); 28 | } 29 | 30 | public LoginPage enterUserName(final String userName) { 31 | userNameTextBox.clearAndType(userName); 32 | 33 | return this; 34 | } 35 | 36 | public LoginPage enterPassword(final String password) { 37 | userNameTextBox.clearAndType(password); 38 | 39 | return this; 40 | } 41 | 42 | public static boolean isUserNameDisplayed() { 43 | return userNameTextBox.isDisplayed(); 44 | } 45 | 46 | /** 47 | * Google Home Page is not part of seleniumtests.com but this how you can move from one page object to another. 48 | * 49 | * @return 50 | * 51 | * @throws Exception 52 | */ 53 | public GoogleHomePage clickSubmitButton() throws Exception { 54 | submitButton.click(); 55 | 56 | return new GoogleHomePage(); 57 | } 58 | 59 | public GoogleHomePage enterLoginData(final User user) throws Exception { 60 | return enterUserName(user.getUserName()).enterPassword(user.getPassword()).clickSubmitButton(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/webpage/RegistrationPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webpage; 15 | 16 | import static com.seleniumtests.core.Locator.locateByCSSSelector; 17 | import static com.seleniumtests.core.Locator.locateByName; 18 | 19 | import com.seleniumtests.core.SeleniumTestsContextManager; 20 | import com.seleniumtests.dataobject.User; 21 | import com.seleniumtests.webelements.ButtonElement; 22 | import com.seleniumtests.webelements.PageObject; 23 | import com.seleniumtests.webelements.TextFieldElement; 24 | 25 | /** 26 | * Provides services offered by Registration Page. 27 | * 28 | *

Date: 10/2/13 Time: 6:26 PM 29 | */ 30 | public class RegistrationPage extends PageObject { 31 | 32 | 33 | // https://github.com/appium/appium/issues/13306 > w3c standard only declares css and xpath locators 34 | private static final TextFieldElement firstNameTextbox = new TextFieldElement("First name text box", 35 | locateByCSSSelector("input[name='firstname']")); 36 | 37 | private TextFieldElement lastNameTextbox = new TextFieldElement("Last name text box", locateByName("lastname")); 38 | 39 | private TextFieldElement userNameTextbox = new TextFieldElement("user name text box", locateByName("username")); 40 | 41 | private TextFieldElement pwd1NameTextbox = new TextFieldElement("password 1 text box", locateByName("psw1")); 42 | 43 | private TextFieldElement pwd2NameTextbox = new TextFieldElement("password 2 text box", locateByName("psw2")); 44 | 45 | private ButtonElement submitButton = new ButtonElement("submit Button", 46 | locateByCSSSelector("input~input[value='Submit']")); 47 | 48 | public RegistrationPage(final boolean openPageURL) throws Exception { 49 | super(firstNameTextbox, openPageURL ? SeleniumTestsContextManager.getThreadContext().getAppURL() : null); 50 | } 51 | 52 | public RegistrationPage enterFirstName(final String firstName) { 53 | firstNameTextbox.clearAndType(firstName); 54 | 55 | return this; 56 | } 57 | 58 | public RegistrationPage enterLastName(final String lastName) { 59 | lastNameTextbox.clearAndType(lastName); 60 | 61 | return this; 62 | } 63 | 64 | public RegistrationPage enterUserName(final String userName) { 65 | userNameTextbox.clearAndType(userName); 66 | 67 | return this; 68 | } 69 | 70 | public RegistrationPage enterPassword(final String password) { 71 | pwd1NameTextbox.clearAndType(password); 72 | 73 | return this; 74 | } 75 | 76 | public RegistrationPage enterConfirmPassword(final String password) { 77 | pwd2NameTextbox.clearAndType(password); 78 | 79 | return this; 80 | } 81 | 82 | public LoginPage clickSubmitButton() throws Exception { 83 | submitButton.click(); 84 | 85 | return new LoginPage(); 86 | } 87 | 88 | public LoginPage submitValidRegistrationData(final User user) throws Exception { 89 | return enterFirstName(user.getFirstName()).enterLastName(user.getLastName()).enterUserName(user.getUserName()) 90 | .enterPassword(user.getPassword()) 91 | .enterConfirmPassword(user.getPassword()).clickSubmitButton(); 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/webpage/SauceLabsPage.java: -------------------------------------------------------------------------------- 1 | 2 | package com.seleniumtests.webpage; 3 | 4 | 5 | import com.seleniumtests.core.SeleniumTestsContextManager; 6 | 7 | import com.seleniumtests.webelements.PageObject; 8 | 9 | 10 | public class SauceLabsPage extends PageObject { 11 | public SauceLabsPage() throws Exception { 12 | } 13 | 14 | public SauceLabsPage(final boolean openAPP) throws Exception { 15 | super(null, 16 | openAPP 17 | ? SeleniumTestsContextManager.getThreadContext() 18 | .getSaucelabsURL() : null); 19 | } 20 | 21 | public void getMeToTheSauceLabs() { 22 | driver.get("https://saucelabs.com/test/guinea-pig"); 23 | System.out.println("title of page is: " + driver.getTitle()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/com/seleniumtests/webpage/UICatalogScreen.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 www.seleniumtests.com 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | */ 13 | 14 | package com.seleniumtests.webpage; 15 | 16 | import org.openqa.selenium.By; 17 | 18 | import com.seleniumtests.core.SeleniumTestsContextManager; 19 | import com.seleniumtests.webelements.PageObject; 20 | import com.seleniumtests.webelements.TextFieldElement; 21 | 22 | public class UICatalogScreen extends PageObject { 23 | 24 | public UICatalogScreen() throws Exception { } 25 | 26 | /** 27 | * Opens log in page. 28 | * 29 | * @param openAPP 30 | * 31 | * @throws Exception 32 | */ 33 | public UICatalogScreen(final boolean openAPP) throws Exception { 34 | super(null, openAPP ? SeleniumTestsContextManager.getThreadContext().getApp() : null); 35 | } 36 | 37 | // appium does not support locating element with name hence xpath is used 38 | private static TextFieldElement uiTextField = new TextFieldElement("UI Text Field", By.xpath("//*[@name='Normal']")); 39 | 40 | public TextFieldElement getTextFields(final String symbol) { 41 | return new TextFieldElement("Text Element", By.xpath("//*[@name='"+symbol+"']")); 42 | } 43 | 44 | public UICatalogScreen clickSymbol(final String symbol) { 45 | getTextFields(symbol).click(); 46 | return this; 47 | } 48 | 49 | public static boolean isUITextFieldDisplayed() { 50 | return uiTextField.isDisplayed(); 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/test/resources/com/seleniumtests/tests/loginuser.csv: -------------------------------------------------------------------------------- 1 | TestEntity.TestCaseId,TestEntity.TestMethod,User.firstName,User.lastName,User.userName,User.password, 2 | TestLinkTestCaseID1,registerWithValidUserData,selenium,test,seleniumtest,123456 3 | TestLinkTestCaseID2,registerWithValidUserData,QTP,test,qtptest,123456 4 | TestLinkTestCaseID22,registerWithInvalidUserData,QTP,test,qtptest,123456 5 | TestLinkTestCaseID222,loginTest,Hercules,spartacus,Herculesspartacus,123456 -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/cert8.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/test/resources/profiles/customProfileDirCUSTFF/cert8.db -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/cert_override.txt: -------------------------------------------------------------------------------- 1 | # PSM Certificate Override Settings file 2 | # This is a generated file! Do not edit. -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/extensions/readystate@openqa.org/chrome.manifest: -------------------------------------------------------------------------------- 1 | content readystate jar:chrome/readystate.jar!/content/ xpcnativewrappers=no 2 | overlay chrome://browser/content/browser.xul chrome://readystate/content/overlay.xul 3 | -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/extensions/readystate@openqa.org/chrome/readystate.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/test/resources/profiles/customProfileDirCUSTFF/extensions/readystate@openqa.org/chrome/readystate.jar -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/extensions/readystate@openqa.org/install.rdf: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | readystate@openqa.org 7 | 2 8 | DocumentReadyState 9 | 1.0 10 | Provides a mechanism to update the document readyState property 11 | 12 | 13 | 14 | 15 | {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 16 | 1.4.1 17 | 4.*.* 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/extensions/{3d7eb24f-2740-49df-8937-200b1cc08f8a}/chrome.manifest: -------------------------------------------------------------------------------- 1 | overlay chrome://browser/content/browser.xul chrome://flashblock/content/flashblock.xul 2 | overlay chrome://global/content/customizeToolbar.xul chrome://flashblock/content/flashblock.xul 3 | 4 | content flashblock jar:chrome/flashblock.jar!/content/flashblock/ 5 | content flashblock jar:chrome/flashblock.jar!/content/flashblock/ contentaccessible=yes 6 | 7 | skin flashblock classic/1.0 jar:chrome/flashblock.jar!/skin/classic/flashblock/ 8 | style chrome://global/content/customizeToolbar.xul chrome://flashblock/skin/flashblock.css 9 | 10 | locale flashblock en-US jar:chrome/flashblock.jar!/locale/en-US/flashblock/ 11 | locale flashblock it-IT jar:chrome/flashblock.jar!/locale/it-IT/flashblock/ 12 | locale flashblock nl-NL jar:chrome/flashblock.jar!/locale/nl-NL/flashblock/ 13 | locale flashblock de-DE jar:chrome/flashblock.jar!/locale/de-DE/flashblock/ 14 | locale flashblock fr-FR jar:chrome/flashblock.jar!/locale/fr-FR/flashblock/ 15 | locale flashblock pl-PL jar:chrome/flashblock.jar!/locale/pl-PL/flashblock/ 16 | locale flashblock ko-KR jar:chrome/flashblock.jar!/locale/ko-KR/flashblock/ 17 | locale flashblock pt-BR jar:chrome/flashblock.jar!/locale/pt-BR/flashblock/ 18 | locale flashblock da-DK jar:chrome/flashblock.jar!/locale/da-DK/flashblock/ 19 | locale flashblock hu-HU jar:chrome/flashblock.jar!/locale/hu-HU/flashblock/ 20 | locale flashblock cs-CZ jar:chrome/flashblock.jar!/locale/cs-CZ/flashblock/ 21 | locale flashblock es-ES jar:chrome/flashblock.jar!/locale/es-ES/flashblock/ 22 | locale flashblock ru-RU jar:chrome/flashblock.jar!/locale/ru-RU/flashblock/ 23 | locale flashblock ro-RO jar:chrome/flashblock.jar!/locale/ro-RO/flashblock/ 24 | locale flashblock ja-JP jar:chrome/flashblock.jar!/locale/ja-JP/flashblock/ 25 | locale flashblock zh-CN jar:chrome/flashblock.jar!/locale/zh-CN/flashblock/ 26 | locale flashblock ar jar:chrome/flashblock.jar!/locale/ar/flashblock/ 27 | locale flashblock fi-FI jar:chrome/flashblock.jar!/locale/fi-FI/flashblock/ 28 | locale flashblock sv-SE jar:chrome/flashblock.jar!/locale/sv-SE/flashblock/ 29 | locale flashblock sk-SK jar:chrome/flashblock.jar!/locale/sk-SK/flashblock/ 30 | locale flashblock zh-TW jar:chrome/flashblock.jar!/locale/zh-TW/flashblock/ 31 | locale flashblock tr-TR jar:chrome/flashblock.jar!/locale/tr-TR/flashblock/ 32 | locale flashblock el-GR jar:chrome/flashblock.jar!/locale/el-GR/flashblock/ 33 | locale flashblock bg-BG jar:chrome/flashblock.jar!/locale/bg-BG/flashblock/ 34 | locale flashblock uk-UA jar:chrome/flashblock.jar!/locale/uk-UA/flashblock/ 35 | locale flashblock te-IN jar:chrome/flashblock.jar!/locale/te-IN/flashblock/ 36 | locale flashblock ca-ES jar:chrome/flashblock.jar!/locale/ca-ES/flashblock/ 37 | locale flashblock is-IS jar:chrome/flashblock.jar!/locale/is-IS/flashblock/ 38 | locale flashblock pt-PT jar:chrome/flashblock.jar!/locale/pt-PT/flashblock/ 39 | locale flashblock vi-VN jar:chrome/flashblock.jar!/locale/vi-VN/flashblock/ 40 | locale flashblock no-NB jar:chrome/flashblock.jar!/locale/no-NB/flashblock/ 41 | locale flashblock es-AR jar:chrome/flashblock.jar!/locale/es-AR/flashblock/ 42 | locale flashblock sr-RS jar:chrome/flashblock.jar!/locale/sr-RS/flashblock/ 43 | -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/extensions/{3d7eb24f-2740-49df-8937-200b1cc08f8a}/chrome/flashblock.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarun3kumar/seleniumtestsframework/4d4df57af228c4fc2da12fea8f263ce26fc6ef82/src/test/resources/profiles/customProfileDirCUSTFF/extensions/{3d7eb24f-2740-49df-8937-200b1cc08f8a}/chrome/flashblock.jar -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/extensions/{3d7eb24f-2740-49df-8937-200b1cc08f8a}/defaults/preferences/flashblock.js: -------------------------------------------------------------------------------- 1 | pref("extensions.{3d7eb24f-2740-49df-8937-200b1cc08f8a}.description", "chrome://flashblock/locale/flashblock.properties"); 2 | pref("flashblock.enabled",false); 3 | pref("flashblock.whitelist", ""); 4 | pref("flashblock.blockLocal",false); 5 | pref("browser.toolbars.showbutton.flashblockMozToggle", false); 6 | pref("flashblock.silverlight.blocked",false); 7 | pref("flashblock.java.blocked",false); 8 | -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/extensions/{3d7eb24f-2740-49df-8937-200b1cc08f8a}/install.rdf: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | {3d7eb24f-2740-49df-8937-200b1cc08f8a} 7 | 2 8 | Flashblock 9 | 1.5.13 10 | Replaces Flash objects with a button you can click to view them. 11 | The Flashblock Team 12 | Ted Drake 13 | Ted Mielczarek 14 | Przemyslaw Bialik 15 | Lorenzo Colitti 16 | Philip Chee 17 | Special thanks to: 18 | - Jesse Ruderman (initial idea) 19 | - Neil Rashbrook (whitelist wizardry) 20 | http://flashblock.mozdev.org/ 21 | chrome://flashblock/content/flashblock-32.png 22 | chrome://flashblock/content/options.xul 23 | 24 | 25 | 26 | 27 | {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 28 | 1.5 29 | 4.*.* 30 | 31 | 32 | 33 | 34 | 35 | 36 | {a463f10c-3994-11da-9945-000d60ca027b} 37 | 1.0 38 | 2.1.* 39 | 40 | 41 | 42 | 43 | 44 | 45 | {3db10fab-e461-4c80-8b97-957ad5f8ea47} 46 | 9.0b1 47 | 9.0.* 48 | 49 | 50 | 51 | 52 | 53 | 54 | {aa5ca914-c309-495d-91cf-3141bbb04115} 55 | 0.2 56 | 2.0.0.* 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/extensions/{503A0CD4-EDC8-489b-853B-19E0BAA8F0A4}/chrome.manifest: -------------------------------------------------------------------------------- 1 | content src chrome/ xpcnativewrappers=no 2 | -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/extensions/{503A0CD4-EDC8-489b-853B-19E0BAA8F0A4}/install.rdf: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | {503A0CD4-EDC8-489b-853B-19E0BAA8F0A4} 7 | 2 8 | Selenium RC Runner 9 | 1.0 10 | Provides a chrome URL that can accept commands from Selenium Remote Control 11 | 12 | 13 | 14 | 15 | {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 16 | 1.4.1 17 | 4.*.* 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/extensions/{538F0036-F358-4f84-A764-89FB437166B4}/chrome.manifest: -------------------------------------------------------------------------------- 1 | content killff kill.html 2 | -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/extensions/{538F0036-F358-4f84-A764-89FB437166B4}/install.rdf: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | {538F0036-F358-4f84-A764-89FB437166B4} 7 | 2 8 | KillFF 9 | 1.0 10 | Provides a chrome URL that can kill the browser 11 | 12 | 13 | 14 | 15 | {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 16 | 1.4.1 17 | 4.*.* 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/test/resources/profiles/customProfileDirCUSTFF/extensions/{538F0036-F358-4f84-A764-89FB437166B4}/kill.html: -------------------------------------------------------------------------------- 1 | 2 | Firefox should die immediately upon viewing this! If you're reading this, there must be a bug! 3 | 4 | 5 | 9 | 10 | 11 | --------------------------------------------------------------------------------