- Trending Categories
- 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 519 Articles for Selenium
4K+ Views
The methods findElements and findElement are used to identify elements on a webpage. While findElement can pinpoint only one element, the findElements method yields a list of matching web elements.The return type of findElements is a list whereas the return type of findElement is a WebElement. If there is no matching element on the page, an exception is thrown by the findElement method. In this scenario, an empty list id returned by the findElements method.A good example of findElements method usage is counting the total number of links or accessing each of links by iterating through the links.SyntaxWebElement m = ... Read More
607 Views
We can run Selenium tests on Chrome browser with the help of the chromedriver.exe executable file. First, we have to download the chromedriver.exe file from the following link − https://sites.google.com/a/chromium.org/chromedriver/downloadsWe have to click on the link which matches with the Chrome browser in our system. Next, choose the link based operating system (Windows, Linux or Mac) we are presently using.Once the download has completed, a zip file gets created. We have to extract the zip file and store the chromedriver.exe file in a desired location. Then, we have to configure the path of the chromedriver.exe file using the System.setProperty method ... Read More
2K+ Views
We can scroll a webpage using coordinates of a webelement in Selenium webdriver using the JavaScript Executor. Selenium executes JavaScript commands with the help of the executeScript method.To get the unique coordinates of an element we shall create an object of the class Point which shall store the location of the webelement obtained from the getLocation method.Then the individual x and y coordinate values can be computed from the getX and the getY methods respectively. Finally, to actually perform scroll upto the coordinates of an element, the command window.scrollBy(x coordinate, y coordinate) is passed as a parameter to the executeScript ... Read More
2K+ Views
We can verify the tooltip of an element using Selenium webdriver using the getAttribute method. A tooltip text is the one which gets displayed while we hover on that element.It disappears once we move the mouse away from the element. A tooltip text generally displays the title attribute value of an element. First, we identify the element then apply the getAttribute method on it. The parameter to be passed to this method is title.Let us investigate the html code of an element - Tools having a tooltip text.Here, the tooltip text displayed from Tools menu is Tools - Online Development ... Read More
855 Views
We have different ways to select an option from a dropdown using Selenium webdriver. This is done with the help of the Select class. A dropdown in the html code is represented by select tag.The options in a dropdown are represented by the option tag. Also, we have to add the statement org.openqa.selenium.support.ui.Select to the code to work with dropdown.The different methods to select an option from a dropdown are listed below −selectByIndex – index of the option to be selected by the dropdown is passed as a parameter. The index starts from 0.WebElement e = driver.findElement(By.className("opt")); Select s = ... Read More
14K+ Views
We can close the active/current tab without closing the browser in Selenium webdriver in Python. By default, Selenium has control over the parent window. Once another browser window is opened, we have to explicitly shift the control with the help of switch_to.window method.The handle id of the browser window where we want to shift is passed as a parameter to that method. The method window_handles returns the list of all window handle ids of the opened browsers.The method current_window_handle is used to hold the window handle id of the browser window in focus. To close only the active or current ... Read More
201 Views
There are pre-conditions to be configured before we can kick off execution in Selenium webdriver. First we have to check the Protection Mode of our IE browser.Launch Internet Explorer → move to Tools Menu → Internet Options.Then go to the Security tab. Check the option Select Enable Protected Mode. Also, we have to choose the Internet as the zone. We can make the level as Mediumhigh.The other Protection zones like Local Intranet and Trusted sites (apart from Restricted sites) should also have the same configuration. Once all the configurations are done, we have to Apply and then click OK.After above ... Read More
318 Views
We can configure IE Driver via System Properties in Environment variables. Firstly, we have to navigate to the link − https://www.selenium.dev/downloads/. Then click on the download link (32 or 64 it) based on the operating system available with us.Once the download is done, a zip file gets created. It needs to be extracted and saved in a location. After the file is extracted, the executable file - IEDriverServer.exe becomes available.Enter environment variables from the Start. Then click on Edit the system environment variables as shown on the below image.Navigate to the Advanced tab in the System Properties pop-up. Then click ... Read More
5K+ Views
We can find an element using the css locator with Selenium webdriver. To identify the element with css, the expression should be tagname[attribute='value'].We can also specifically use the id attribute to create a css expression.With id, the format of a css expression should be tagname#. For example, input#txt [here input is the tagname and the txt is the value of the id attribute].With class, the format of css expression should be tagname. . For example, input.cls-txt [here input is the tagname and the cls-txt is the value of the class attribute].If there are n children of a parent element, and ... Read More
7K+ Views
We can find an element using the xpath locator with Selenium webdriver.To identify the element with xpath, the expression should be //tagname[@attribute='value'].To identify the element with xpath, the expression should be //tagname[@class='value']. There can be two types of xpath – relative and absolute. The absolute xpath begins with / symbol and starts from the root node upto the element that we want to identify.For example, /html/body/div[1]/div/div[1]/aThe relative xpath begins with // symbol and does not start from the root node. For example, //img[@alt='tutorialspoint']Let us see the html code of the highlighted element starting from the root.The absolute xpath for the ... Read More