Found 190 Articles for Selenium Web Driver

What is the explicit wait in Selenium with python?

Debomita Bhattacharjee
Updated on 28-Jul-2020 15:24:23

2K+ Views

While working with Selenium, there may be situations when we see that after page load action by the browser, the web elements are getting loaded at various intervals of time.This type of situation leads to syncing problems between Selenium and the web element on the page. The identification of elements does not happen due to the absence of that element in DOM. The exception like ElementNotVisibleException is thrown due to this.The wait concept in Selenium overcomes this problem and gives a delay between elements identification and actions performed on them. The explicit wait is applied not to all but to ... Read More

What is implicit wait in Selenium with python?

Debomita Bhattacharjee
Updated on 28-Jul-2020 15:21:57

1K+ Views

While working with Selenium, there may be situations when we see that after page load action by the browser, the web elements are getting loaded at various intervals of time.This type of situation leads to syncing problems between Selenium and the web element on the page. The identification of elements does not happen due to the absence of that element in DOM. The exception like ElementNotVisibleException is thrown due to this.The wait concept in Selenium overcomes this problem and gives a delay between elements identification and actions performed on them. An implicit wait can be considered as default waiting time ... Read More

What are the various waits available in Selenium with python?

Debomita Bhattacharjee
Updated on 28-Jul-2020 15:20:13

358 Views

While working with Selenium, there may be situations when we see that after page load action by the browser, the web elements are getting loaded at various intervals of time.This type of situation leads to syncing problems between Selenium and the web element on the page. The identification of elements does not happen due to the absence of that element in DOM. The exception like ElementNotVisibleException is thrown due to this.The wait concept in Selenium overcomes this problem and gives a delay between elements identification and actions performed on them. Selenium web driver supports mainly two types of waits −Implicit ... Read More

How to refresh a browser then navigate to a new page with Javascript executor in Selenium with python?

Debomita Bhattacharjee
Updated on 28-Jul-2020 15:16:02

827 Views

We can refresh a page and then navigate to a new page from the current page with Javascript executor in Selenium. Javascript is a language used for scripting and runs on the client side (on the browser). Selenium gives default methods to work with Javascript.Syntaxdriver.execute_script('history.go[0]') javaS = "window.location = 'https://www.tutorialspoint.com/index.htm'" driver. execute_script(javaS)There are couple of methods of working with Javascript −Javascript execution at document root level.In this process, we shall identify the element with locators (class or id) and then perform the required action on it. Then execute_script() method is called and the Javascript is passed as a string to ... Read More

How to get the title and URL of a webpage with Javascript executor in Selenium with python?

Debomita Bhattacharjee
Updated on 28-Jul-2020 15:13:43

751 Views

We can get the title and URL of a webpage with Javascript executor in Selenium. Javascript is a language used for scripting and runs on the client side (on the browser). Selenium gives default methods to work with Javascript.Syntaxprint(driver.execute_script('return document.title')) print(driver.execute_script('return document.URL'))There are couple of methods of working with Javascript −Javascript execution at document root level.In this process, we shall identify the element with locators (class or id) and then perform the required action on it. Then execute_script() method is called and the Javascript is passed as a string to it.Syntaxjavas = "document.getElementsByName('user-search')[0].click();" driver.execute_script(javas)Please note, we have used getElementsByName('user-search')[0]. The ... Read More

How to perform vertical scrolling of a webpage with Javascript executor in Selenium with python?

Debomita Bhattacharjee
Updated on 28-Jul-2020 14:54:54

421 Views

We can perform vertical scrolling of a webpage with Javascript executor in Selenium. Javascript is a language used for scripting and runs on the client side (on the browser). Selenium gives default methods to work with Javascript.Syntaxdriver.execute_script("window.scrollTo(0, document.body.scrollHeight);")There are couple of methods of working with Javascript −Javascript execution at document root level.In this process, we shall identify the element with locators (class or id) and then perform the required action on it. Then execute_script() method is called and the Javascript is passed as a string to it.Syntaxjavas = "document.getElementsByName('user-search')[0].click();" driver.execute_script(javas)Please note, we have used getElementsByName('user-search')[0]. The functions like getElementsByName and ... Read More

How to click on a button with Javascript executor in Selenium with python?

Debomita Bhattacharjee
Updated on 28-Jul-2020 14:49:42

8K+ Views

We can click on a button with a Javascript executor in Selenium. Javascript is a language used for scripting and runs on the client side (on the browser). Selenium gives default methods to work with Javascript.Syntaxb = driver.find_element_by_xpath("//input[starts-with(@class, 'gsc')]") driver.execute_script("arguments[0].click();", b)There are couple of methods by which Javascript can be executed within browser −Javascript execution at document root level.In this process, we shall identify the element with locators (class or id) and then perform the required action on it. Then execute_script() method is called and the Javascript is passed as a string to it.Syntaxjavas = "document.getElementsByName('user-search')[0].click();" driver.execute_script(javas)Please note, we have ... Read More

How to verify the color and background color of a web element in Selenium?

Debomita Bhattacharjee
Updated on 11-Jun-2020 12:12:43

9K+ Views

We can verify the color and background color of a web element in Selenium with the help of getCSSValue() method.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class CssColorValue {    public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       String url = "https://www.tutorialspoint.com/index.htm";       driver.get(url);       driver.manage().window().maximize();       driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);       //getting color attribute with getCssValue()       String colr = driver.findElement(By.xpath("//*[text()=’GATE Exams’]")) ... Read More

List down the differences between Selenium and UTP.

Debomita Bhattacharjee
Updated on 11-Jun-2020 12:09:22

109 Views

The differences between Selenium and UTP are listed down below.sl.no.SeleniumUTP1It is open source and can be used free.It is a licensed tool and is commercialized for use.2It supports the majority of browsers like Chrome, Firefox, Internet Explorer, Safari and so on.It supports Chrome, Firefox and Internet Explorer.3It only tests web based applications.It tests both windows and web based applications.4There is no in built object Repository.By default, object repositories are available and maintained.5It can be developed on multiple languages like Java, C#, Javascript, Python and so on.It can be developed only on VB scripts.6There is no external support for vendors for ... Read More

How to verify if an element is displayed on screen in Selenium?

Debomita Bhattacharjee
Updated on 11-Jun-2020 12:07:49

9K+ Views

We can verify the visibility of web elements like edit box, checkbox, radio buttons and so on with the help of method listed bels −isDisplayed()This method checks if a webelement is present on the screen.Syntax −Boolean result = driver.findElement(By.xpath("//span[text()=’Coding Ground’]")).isDispayed();isSelected()This method checks the status of the radio button, check box and options in the static dropdown.Syntax −Boolean btnresult = driver.findElement(By.xpath("//xpath[contains(@class, ’gsc-search-button’)]")).isSelected();isEnabled()Syntax −Boolean btnresult = driver.findElement(By.xpath("//xpath[contains(@class, ’gsc-search-button’)]")).isEnabled();This method if an element is enabled or not.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 ElementStatus{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",       ... Read More

Advertisements