- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 190 Articles for Selenium Web Driver
2K+ Views
We can use the ClickAt command in Selenium IDE. The ClickAt command has two arguments − the element locator and the coordinates which mentions the x and y coordinates of the mouse with respect to the element identified by the locator.This method is used when we want to click on a position having a specific mouse coordinate. It can click on a checkbox, radio button or link.SyntaxclickAt(locator, coordinates)In the Selenium IDE, Choose a row inside the test script edit box. Enter click at the Command field. To identify the dropdown with the id locator, enter the Target field. The x ... Read More
2K+ Views
We can scroll down with Selenium. Selenium is unable to handle scrolling directly. It takes the help of the Javascript Executor to perform the scrolling action up to an element.First of all we have to locate the element up to which we have to scroll to. Next, we shall use the Javascript Executor to run the Javascript commands. The method executeScript is used to run Javascript commands in Selenium. We shall take the help of the scrollIntoView method in Javascript and pass true as an argument to the method.SyntaxWebElement elm = driver.findElement(By.name("name")); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", elm);Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; ... Read More
462 Views
We can set Google Chrome in Selenium. Java JDK, Eclipse and Selenium webdriver should be configured in the system before setting up the Chrome browser.Steps to set Google Chrome are −Navigate to the link: https://chromedriver.chromium.org/downloads.Select the Chrome driver link which matches with the Chrome browser in the local system.Then, we have to select the Chrome driver link which is compatible with the operating system we are using.A zip file gets downloaded. Extract and save the chromedriver.exe file in a location.We can configure the chromedriver.exe file in the following ways −By setting the System Properties in the Environment Variables. Go to ... Read More
342 Views
We can simulate a Print screen button with Selenium. The screenshot is captured with the Print screen button. Capturing a screenshot is a three way process. It is an important step towards failure analysis.We shall convert the driver object to TakeScreenshot interface.SyntaxTakesScreenshot s = (TakesScreenshot)driver;Then, with the getScreenshotAs method we shall have an image file and copy that file to a location with FileUtils.copyFile method.SyntaxFile sp=s.getScreenshotAs(OutputType.FILE); FileUtils.copyFile(sp, new File("path of image file"));Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.apache.commons.io.FileUtils; import java.io.File; public class PrintScreenSimulate { public static void main(String[] args) { ... Read More
501 Views
We can clear browser cookies in Selenium. The method deleteCookieNamed shall delete a cookie with a specific name. The cookie named is passed as an argument to the method. First, we will add a cookie, then get it and finally delete it.Syntaxdriver.manage().deleteCookieNamed("foo");Another method called the deleteAllCookies deletes all cookies from the existing domain. First, we will add the cookies, then get and delete them.Syntaxdriver.manage().deleteAllCookies();Exampleimport java.util.Set; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class DeleteCookiesViaName{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); ... Read More
2K+ Views
We can delete cookies on all domains with Selenium. The method deleteAllCookies is used to delete all cookies from the present domain. First, we shall add cookies, then get them and finally delete all the cookies.Syntaxdriver.manage().deleteAllCookies();Exampleimport java.util.Set; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class DeleteCookies{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://www.tutorialspoint.com/index.htm"); // wait of 4 seconds driver.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS); // setting name and value for cookie ... Read More
634 Views
We can install Selenium in a conda environment. The conda has multiple channels to find packages. We have to search for a package which is compatible with our operating system.All the packages shall be available in the link −https://anaconda.org/search?q=selenium&sort=ndownloads&sort_order=−1&reverse=trueOut of all the packages, the most popular and downloaded one is available in the link −https://anaconda.org/conda-forge/seleniumTo install this package, execute any one of the following commands −
8K+ Views
We can open a link in the new tab with Selenium. . The methods Keys.chord and sendKeys can be used for this. The Keys.chord method allows you to pass multiple keys simultaneously.We shall send Keys.CONTROL and Keys.ENTER as arguments to the Keys.chord method. Then the complete string is then passed as an argument to the sendKeys method. Finally, the sendKeys method has to be applied on the link which is identified by driver.findElement method.SyntaxString clicklnk = Keys.chord(Keys.CONTROL, Keys.ENTER); driver.findElement(By.xpath("//*[text()='Privacy Policy']")). sendKeys(clicklnk);Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class OpenInNwTab{ public static void main(String[] args) { ... Read More
299 Views
Selenium is a suite of tools which is used to a large extent by the testing community. It cannot test the desktop application and can only automate web based test cases.Some of the popular browsers supported are −FirefoxChromeIESafariOperaSome of the popular operating systems supported are −Linux/UnixMacWindowsAnother fact, why Selenium is so popular is that, it can work on different programming languages like −JavaPythonJavaScriptRubyC#PHPSome of the components of Selenium are −Selenium IDESelenium RCSelenium WebdriverSelenium Grid
2K+ Views
We can clear text from a text area with Selenium. We shall use the clear method to remove the content from a text area or an edit box. First we shall identify the text area with the help of any locator.A text area is identified with textarea tagname in the html code. Let us input some text inside the below text area, then clear the text.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class TextAreaClear{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("http://www.uitestpractice.com/Students/Form"); ... Read More