Posts

Showing posts from April, 2020

GIT

sending my code to GIT GIT Status (if any changes hsow in red color) GIT ADD .(all edited/u[dated files will be added to git) GIT Commit "Message--what changes are" GIT PUSH After pushing code to the repository , i will open a pull request -PR and assign to lead/peer. -------------------- getting GIT code to Local updated code to local GIT checkout "Master branch" GIT PULL (we will get all updated code from git to local) git checkout "local branch" git merge "master branch" if any conflicts()

Upload a File

7. How do you upload files using Selenium A) we can use action class sendKeys(use the path of the file) to upload files. if not using selenium then it is AutoIT AutoIT Runtime.getRuntime().exec("E:\\AutoIT\\FileUpload.exe");

Exception

Though there are many Exception classes under WebDriverException, we commonly see the below ones. NoSuchElementException NoSuchWindowException NoSuchFrameException NoAlertPresentException InvalidSelectorException ElementNotVisibleException ElementNotSelectableException TimeoutException NoSuchSessionException StaleElementReferenceException Details : ElementNotVisibleException : If selenium tries to find an element but the element is not visible within the page NoAlertPresentException : If a user tries to handle an alert box but the alert is not present. NoSuchAttributeException : While trying to get attribute value but the attribute is not available in DOM. NoSuchElementException : This exception is due to accessing an element which is not available on the page. WebDriverException : Exception comes when a code is unable to initialize WebDriver. try { WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds( 10 )); wait.Until(ExpectedCondit...

xml

testng.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="BDD Test Suite" verbose="1" parallel="tests" thread-count="1" configfailurepolicy="continue"> <test name="FREE CRM Test" annotations="JDK" preserve-order="true"> <classes> <class name="MyRunner.TestRunner" /> </classes> </test> </suite> pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>CucumberTestNG</groupId> <artifactId>CucumberTestNG</artifactId> <vers...

Mouse Click & Keyboard Event : Action Class

There are a lot of methods in this class which can be categorized into two main categories: Keyboard Events Mouse Events   Different Methods for performing Keyboard Events: keyDown(modifier key): Performs a modifier key press.  sendKeys(keys to send ): Sends keys to the active web element. keyUp(modifier key): Performs a modifier key releas e. Actions actions = new Actions(webdriver object); WebElement element = driver.findElement(By strategy to identify element); actions. keyDown (element, Keys.SHIFT); actions. sendKeys (“TextToBeConvertAndSendInUpperCase”); actions. keyUp (Keys.SHIFT); action.perform(); actions.build(); Different Methods for performing Mouse Events: Right Click  //Instantiate Action Class   Actions actions = new Actions(driver);  //Retrieve WebElement to perform right click   WebElement btnElement = driver.findElement(By.id("rightClickBtn"));   //Right Click the button to display Context Menu&n...