Debomita Bhattacharjee

Debomita Bhattacharjee

590 Articles Published

Articles by Debomita Bhattacharjee

Page 23 of 59

What are the drawbacks of Selenium WebDriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 06-Apr-2021 593 Views

Some of the prominent drawbacks of Selenium are listed below −Has assistance for only web oriented applications.Time consuming to configure the environment unlike the paid tools like UFT.Has no features provided by Test Management tools like ALM or UFT.New characteristics introduced in Selenium, sometimes do not work as expected.Has no in-built test report generation. It has to be integrated with TestNG/JUnit for reports.Cannot be integrated with Test Management tools like ALM or UFT.Cannot be used for verifying images.Has no record and play feature, hence building a test script needs considerable time and effort.Cannot be used for verifying mobile applications. We ...

Read More

How do I find an element that contains specific text in Selenium WebDriver (Python)?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 06-Apr-2021 6K+ Views

We can find an element that contains specific text with Selenium webdriver in Python using the xpath. This locator has functions that help to verify a specific text contained within an element.The function text() in xpath is used to locate a webelement depending on the text visible on the page. Another function contains() in xpath is used to locate a webelement with the sub-text of actual text visible on the page.Let us try to identify the element having the specific text - Privacy Policy.Syntaxl = driver.find_element_by_xpath("//a[text()='Privacy Policy']") m = driver.find_element_by_xpath("//a[contains(text(), 'Privacy')]")Examplefrom selenium import webdriver #set chromodriver.exe path driver = webdriver.Chrome(executable_path="C:\chromedriver.exe") ...

Read More

Java Selenium Chromedriver.exe Does not Exist IllegalStateException

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 06-Apr-2021 4K+ Views

An IllegalStateException is thrown while working with Chrome browser if the chromedriver.exe file path is set incorrectly in the method System.setProperty. Once this executable file is downloaded, it has to be extracted. Then its path should be copied and added as a parameter to the System.setProperty method.SyntaxSystem.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\DebomitaJava\chromedriver.exe")Also, it must be remembered that, for Windows, we have to specify the .exe extension while including the path. But it is not required for Mac or Ubuntu. We should also ensure that the chromedriver.exe file that we are using is compatible with the local Chrome browser version.Let us see an example for ...

Read More

Check that the element is clickable or not in Selenium WebDriver

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 06-Apr-2021 21K+ Views

We can check if the element is clickable or not in Selenium webdriver using synchronization. In synchronization, there is an explicit wait where the driver waits till an expected condition for an element is met.To verify, if the element can be clicked, we shall use the elementToBeClickable condition. A timeout exception is thrown if the criteria for the element is not satisfied till the driver wait time.SyntaxWebDriverWait wt = new WebDriverWait(driver, 5); wt.until(ExpectedConditions.elementToBeClickable (By.className("s-buy")));We have to add - import org.openqa.selenium.support.ui.ExpectedConditions and import org.openqa.selenium.support.ui.WebDriverWait statements to implement ExpectedConditions in our code.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; import ...

Read More

How to open browser window in incognito/private mode using python selenium webdriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 03-Apr-2021 8K+ Views

We can open a browser window in incognito/private mode with Selenium webdriver in Python using the ChromeOptions class. We have to create an object of the ChromeOptions class.Then apply the method add_argument to that object and pass the parameter -- incognito has a parameter. Finally, this information has to be passed to the webdriver object.Syntaxc = webdriver.ChromeOptions() c.add_argument("--incognito")Examplefrom selenium import webdriver #object of ChromeOptions class c = webdriver.ChromeOptions() #incognito parameter passed c.add_argument("--incognito") #set chromodriver.exe path driver = webdriver.Chrome(executable_path="C:\chromedriver.exe", options=c) driver.implicitly_wait(0.5) #launch URL driver.get("https://www.tutorialspoint.com/tutor_connect/index.php")Output

Read More

How to capture the text from Alert Message in Selenium Webdriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 03-Apr-2021 3K+ Views

We can capture the text from the alert message in Selenium webdriverwith the help of the Alert interface. By default, the webdriver object has control over the main page, once an alert pop-up gets generated, we have to shift the webdriver focus from the main page to the alert.This is done with the help of the switchTo().alert() method. Once the driver focus is shifted, we can obtain the text of the pop-up with the help of the method switchTo().alert().getText(). Finally we shall use the accept method to accept the alert and dismiss method to dismiss it.Let us take an example ...

Read More

How to input text in the text box without calling the sendKeys() using Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 03-Apr-2021 19K+ Views

We can input text in the text box without the method sendKeys with thehelp of the JavaScript Executor. Selenium executes JavaScript commands with the help of the executeScript method.The JavaScript command to be run is passed as parameter to the method. To enter text we shall first identify the input box with the JavaScript method document.getElementById. Then we have to apply the value method on it.Let us enter text Selenium in the below input box −SyntaxJavascriptExecutor j = (JavascriptExecutor)driver; j.executeScript ("document.getElementById('gsc-i-id1').value='Selenium'");Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.JavascriptExecutor; public class JsEnterText{    public static void main(String[] ...

Read More

How to click on image in selenium webdriver Python?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 03-Apr-2021 4K+ Views

We can click on an image with Selenium webdriver in Python using the method click. First of all, we have to identify the image with the help of any of the locators like id, class, name, css, xpath, and so on. An image in the html code is represented by the img tagname.Let us see the html code of an image element.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; public class ImageClk{    public static void main(String[] args) {       System.setProperty("webdriver.gecko.driver", "C:\Users\ghs6kor\Desktop\Java\geckodriver.exe");       WebDriver driver = new FirefoxDriver();       //implicit wait   ...

Read More

How to get Tooltip Text in Selenium Webdriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 03-Apr-2021 5K+ Views

We can get the tooltip text in Selenium webdriver with help of the method - getAttribute. The attribute title should be passed as a parameter to this method.This technique is only applicable if the element has a title attribute.The tooltip text is the one which gets displayed on hovering the mouse over the element. In the below html code, an element having a tooltip has the attribute title and the value set for title is actually the tooltip text.The below image shows the menu Coding Ground showing the tooltip text as - Coding Ground - Free Online IDE and Terminal.SyntaxWebElement ...

Read More

How to find Elements in a Webpage using JavaScript in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 03-Apr-2021 2K+ Views

We can find elements in a web page with the help of JavaScript. We can also validate the elements returned by the JavaScript methods in the browser Console (Pressing F12). JavaScript methods to find elements are −getElementsByTagnameTo obtain a collection of elements with the matching tagname passed as parameter to the method. If there are no matching elements, an empty collection is returned.Syntaxdocument.getElementsByTagName("") To get the first matching element, document.getElementsByTagName("")[0]getElementsByNameTo obtain a collection of elements with the matching value of name attribute passed as parameter to the method. If there are no matching elements, an empty collection is returned.Syntaxdocument.getElementsByName("") To ...

Read More
Showing 221–230 of 590 articles
« Prev 1 21 22 23 24 25 59 Next »
Advertisements