├── alert.html ├── dragdrop.html ├── drivers ├── chromedriver ├── chromedriver.exe └── geckodriver ├── iframe.html ├── iframe1.html ├── javaScriptAlert.html ├── pom.xml ├── src ├── main │ └── java │ │ └── Core Java.pptx └── test │ └── java │ ├── CustomeListener │ └── ListenerInSelenium.java │ ├── Locator │ ├── XpathCSS1.properties │ └── locator.properties │ ├── RetryInSelenium │ ├── Retry.java │ └── RetryListener.java │ ├── config │ ├── config.properties │ └── or.properties │ ├── log4JForSelenium │ ├── TestBase.java │ ├── TestLog4J.java │ └── log4J.properties │ ├── propertiesFileInSelenium │ ├── Login.java │ ├── Logout.java │ └── TestBase.java │ ├── scroll │ ├── ScrollInSelenium.java │ └── ZoomInZoomOutInSelenium.java │ ├── selenium │ ├── AlertBox.java │ ├── CSSINSelenium.xlsx │ ├── DownloadingfileInSelenium.java │ ├── DragDropTest.java │ ├── ExcelReport.java │ ├── HandelTable.java │ ├── IframeTest.java │ ├── ImageCompareBasedOnFixel.java │ ├── ImageComparison.java │ ├── JavaScriptAlert.java │ ├── RedBus.java │ ├── SelectDate.java │ ├── SelectDateInCalander.java │ ├── SeleniumWithJavaScriptExecuator.java │ ├── TableHandeling.java │ ├── VerifyDynamicObject.java │ ├── XPath.xlsx │ ├── XpathAndCssInSelenium.properties │ ├── object.properties │ ├── questionsAndAnswers │ │ ├── Series1.java │ │ ├── Series2.java │ │ ├── Series3.java │ │ ├── Series4.java │ │ ├── Series5.java │ │ ├── Series6.java │ │ ├── Series7.java │ │ ├── Series8.java │ │ ├── Series9.java │ │ └── or.properties │ └── seleniumSyllanus.pptx │ ├── seleniumExamples │ ├── CountNumberOfLinksInPage.java │ ├── DeleteAllEmailsFromInobx.java │ ├── DeleteEmailBasedOnSubjectLine.java │ ├── DownloadingfileInSelenium.java │ ├── Example1.java │ ├── FilterProduct.java │ ├── HowToSelectWindowInSelenium.java │ ├── HowToVerifyCommonTextInSelenium.java │ ├── ImageComparison.java │ ├── SelectDropDownInSelenium.java │ ├── VerifyCollapsedAndExpandedObjectInSelenium.java │ ├── VerifyDisableAndEnabledObjectInSelenium.java │ ├── VerifyDisableObjectInSelenium.java │ └── VerifyLowestFirstPriceListInProduct_deatilsPage.java │ ├── testBase │ └── TestBase.java │ ├── testCustomeListener │ ├── Listener.xml │ ├── TestBase.java │ └── TestLogin.java │ ├── testNG │ ├── Allannotaions.java │ ├── DataProviderTest.java │ ├── DependsOnTest.java │ ├── EnableAndDisableTest.java │ ├── GroupTest.java │ └── ParametersInTestNG.java │ └── webEventListenerInSelenium │ ├── TestBase.java │ ├── TestEventListener.java │ └── WebEventListener.java ├── table.html ├── test-output ├── collapseall.gif ├── jquery-1.7.1.min.js ├── old │ ├── Default suite │ │ └── Default test.properties │ ├── Regression Suit │ │ ├── Test.properties │ │ └── Test1.properties │ └── Suite │ │ └── Test.properties └── testng-reports.js └── testNG.xml /alert.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Click the button to display an alert box:

6 | 7 | 8 | 9 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /dragdrop.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 26 | 27 | 28 | 29 |

Drag the W3Schools image into the rectangle:

30 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /drivers/chromedriver: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LearnByBhanuPratap/seleniumBasic/3154a32305de89c39cb3845d201219ba596bfced/drivers/chromedriver -------------------------------------------------------------------------------- /drivers/chromedriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LearnByBhanuPratap/seleniumBasic/3154a32305de89c39cb3845d201219ba596bfced/drivers/chromedriver.exe -------------------------------------------------------------------------------- /drivers/geckodriver: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LearnByBhanuPratap/seleniumBasic/3154a32305de89c39cb3845d201219ba596bfced/drivers/geckodriver -------------------------------------------------------------------------------- /iframe.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /iframe1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 7 | 10 | 13 |
14 | 17 |
18 |
19 | 20 | -------------------------------------------------------------------------------- /javaScriptAlert.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Click the button to display a confirm box.

6 | 7 | 8 | 9 |

10 | 11 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | selenium 5 | selenium 6 | 0.0.1-SNAPSHOT 7 | 8 | 23 | 24 | 25 | 26 | org.seleniumhq.selenium 27 | selenium-java 28 | 3.4.0 29 | 30 | 31 | 32 | org.apache.poi 33 | poi 34 | 3.10-FINAL 35 | 36 | 37 | org.apache.poi 38 | poi-ooxml 39 | 3.10-FINAL 40 | 41 | 42 | 43 | org.testng 44 | testng 45 | 6.8 46 | test 47 | 48 | 49 | 50 | org.apache.logging.log4j 51 | log4j-api 52 | 2.6.2 53 | 54 | 55 | org.apache.logging.log4j 56 | log4j-core 57 | 2.6.2 58 | 59 | 60 | 61 | xml-apis 62 | xml-apis 63 | 1.4.01 64 | 65 | 66 | 67 | log4j 68 | log4j 69 | 1.2.17 70 | 71 | 72 | 73 | com.relevantcodes 74 | extentreports 75 | 2.40.2 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/main/java/Core Java.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LearnByBhanuPratap/seleniumBasic/3154a32305de89c39cb3845d201219ba596bfced/src/main/java/Core Java.pptx -------------------------------------------------------------------------------- /src/test/java/CustomeListener/ListenerInSelenium.java: -------------------------------------------------------------------------------- 1 | package CustomeListener; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.text.SimpleDateFormat; 6 | import java.util.Calendar; 7 | 8 | import org.apache.commons.io.FileUtils; 9 | import org.openqa.selenium.OutputType; 10 | import org.openqa.selenium.TakesScreenshot; 11 | import org.testng.ITestContext; 12 | import org.testng.ITestListener; 13 | import org.testng.ITestResult; 14 | import org.testng.Reporter; 15 | 16 | import testCustomeListener.TestBase; 17 | 18 | 19 | 20 | public class ListenerInSelenium extends TestBase implements ITestListener { 21 | 22 | public void onFinish(ITestContext arg0) { 23 | Reporter.log("Test is finished:" + arg0.getName()); 24 | 25 | } 26 | 27 | public void onStart(ITestContext arg0) { 28 | Reporter.log("Test is started:" + arg0.getName()); 29 | 30 | } 31 | 32 | public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) { 33 | // TODO Auto-generated method stub 34 | 35 | } 36 | 37 | public void onTestFailure(ITestResult arg0) { 38 | 39 | if (!arg0.isSuccess()) { 40 | Calendar calendar = Calendar.getInstance(); 41 | SimpleDateFormat formater = new SimpleDateFormat("dd_MM_yyyy_hh_mm_ss"); 42 | 43 | String methodName = arg0.getName(); 44 | 45 | File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); 46 | try { 47 | String reportDirectory = new File(System.getProperty("user.dir")).getAbsolutePath() + "/src/test/java/"; 48 | File destFile = new File(reportDirectory + "/failure_screenshots/" + methodName + "_" + formater.format(calendar.getTime()) + ".png"); 49 | 50 | FileUtils.copyFile(scrFile, destFile); 51 | 52 | Reporter.log(" "); 53 | 54 | } catch (IOException e) { 55 | e.printStackTrace(); 56 | } 57 | } 58 | 59 | } 60 | 61 | public void onTestSkipped(ITestResult arg0) { 62 | // TODO Auto-generated method stub 63 | 64 | } 65 | 66 | public void onTestStart(ITestResult arg0) { 67 | Reporter.log(ITestResult.class.getSimpleName() + " Test started"); 68 | 69 | } 70 | 71 | public void onTestSuccess(ITestResult arg0) { 72 | if (arg0.isSuccess()) { 73 | Calendar calendar = Calendar.getInstance(); 74 | SimpleDateFormat formater = new SimpleDateFormat("dd_MM_yyyy_hh_mm_ss"); 75 | 76 | String methodName = arg0.getName(); 77 | 78 | File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); 79 | try { 80 | String reportDirectory = new File(System.getProperty("user.dir")).getAbsolutePath() + "/src/test/java/"; 81 | File destFile = new File(reportDirectory + "/Test_sucess/" + methodName + "_" + formater.format(calendar.getTime()) + ".png"); 82 | 83 | FileUtils.copyFile(scrFile, destFile); 84 | 85 | Reporter.log(" "); 86 | 87 | } catch (IOException e) { 88 | e.printStackTrace(); 89 | } 90 | } 91 | 92 | 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/test/java/Locator/XpathCSS1.properties: -------------------------------------------------------------------------------- 1 | HTML 2 | Projects 3 | 4 | X Path 5 | //tagName[@attributeName='AttributeValue'] 6 | //a[@href='/projects/'] 7 | //a[@title='Selenium Projects'] 8 | CSS 9 | tagName[attributeName='AttributeValue'] 10 | a[href='/projects/'] 11 | a[title='Selenium Projects'] 12 | 13 | Download 14 | X Path 15 | //a[@href='/download/'] 16 | //title[@href='Get Selenium'] 17 | //a[contains(text(),'Download')] 18 | CSS 19 | a[href='/download/'] 20 | title[href='Get Selenium'] 21 | 22 |