Debomita Bhattacharjee

Debomita Bhattacharjee

590 Articles Published

Articles by Debomita Bhattacharjee

Page 29 of 59

How do I verify that an element does not exist in Selenium 2?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 01-Feb-2021 7K+ Views

We can verify if an element does not exist in Selenium webdriver. To achieve this, we shall use the method getPageSource which gets the entire page source. So we can obtain a complete page source and check if the text of the element exists.We also use the findElements method and utilize any locators like xpath, CSS, and so on to identify the matching elements. The findElements gives an elements list.We shall count the number of elements returned by the list with the help of the size method. If the value of size is greater than 0, then the element exists ...

Read More

How to integrate Sikuli scripts into Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 01-Feb-2021 2K+ Views

We can integrate Sikuli scripts into Selenium webdriver. Sikuli is an automation tool which is open-source. It has the feature to capture the images on the elements as well as perform operations on them.Some of the advantages of Sikuli are −Desktop or Windows applications can be automated.Can be used for flash testing.Can be used on platforms like mobile, Mac, and Linux.It is based on image recognition technique.Can be easily integrated with Selenium.To integrate Sikuli with Selenium, follow the below steps − Navigate to the link − https://launchpad.net/sikuli/+download.Click on the jar to download it (which can be used for Java environments) ...

Read More

How to Resolve Stale Element Reference Exception in Selenium WebDriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 01-Feb-2021 7K+ Views

We can resolve StaleElementReferenceException in Selenium webdriver. The term stale means something which is not fresh and decayed. Thus a stale element points to an element which is not present any more.There may be a case, when an element was in DOM initially but after modifications in Document Object Model (DOM), the element becomes stale and the StaleElementReferenceException is thrown if we make an attempt to access this element.This exception is caused whenever an element is not present in the DOM, or deleted. We can handle this exception by the following ways −Refreshing the page and verifying again.Implement retry method.ExampleCode ...

Read More

How to convert commands recorded in Selenium IDE to Java?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 01-Feb-2021 2K+ Views

We can convert commands recorded in Selenium IDE to Java. To convert commands first navigate to File menu, then select the option Export Test case As.After clicking it, all the possible options for conversion get displayed. Choose the option Java/ Junit 4/ WebDriver.Finally, we have to save the file with the .java extension. Then we can open this file using a text Editor or IDE.We can also convert commands recorded in Selenium IDE to Java by navigating to the Options menu. As the Selenium IDE Options pop−up comes up, select the checkbox Enable experimental features. Then click on OK.Next, select ...

Read More

Can Selenium interact with an existing browser session?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 01-Feb-2021 5K+ Views

We can interact with an existing browser session. This is performed by using the Capabilities and ChromeOptions classes. The Capabilities class obtains the browser capabilities with the help of the getCapabilities method.This is generally used for debugging purposes when we have a large number of steps in a test and we do not want to repeat the same steps. First of all we shall launch the browser and enter some text in the below edit box.Exampleimport org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.Capabilities; import org.openqa.selenium.By; import java.util.Map; import java.util.concurrent.TimeUnit; public class ConnectExistingSession{    public static void main(String[] args)    throws ...

Read More

How do I set the Selenium webdriver get timeout?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 01-Feb-2021 5K+ Views

We can set the Selenium webdriver to get timeout. There are numerous methods to implement timeouts. They are listed below −setScriptTimeout.pageLoadTimeout.implicitlyWait.The setScriptTimeout is the method to set the time for the webdriver. This is usually applied for an asynchronous test to complete prior throwing an exception. The default value of timeout is 0.This method is generally used for JavaScript commands in Selenium. If we omit setting time for the script, the executeAsyncScript method can encounter failure due to the more time consumed by the JavaScript to complete execution.If the timeout time is set to negative, then the JavaScript can execute ...

Read More

How to execute a Javascript function in Python with Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 01-Feb-2021 3K+ Views

We can execute a JavaScript function in Python with Selenium webdriver. DOM interacts with the elements via JavaScript. Selenium is capable of executing JavaScript commands with the execute_script method.Few actions like web scrolling cannot be done by Selenium directly. For this, we shall use the JavaScript Executor. We shall take the help of the JavaScript command window.scrollTo and pass it to the execute_script method. To scroll to the bottom of the page, we have to pass 0 and document.body.scrollHeight as parameters to the window.scrollTo.Syntaxdriver.execute_script("window.scrollTo(0, document.body.scrollHeight);")Examplefrom selenium import webdriver driver = webdriver.Firefox(executable_path="C:\geckodriver.exe") driver.implicitly_wait(0.5) driver.get("https://www.tutorialspoint.com/index.htm") #scroll till page bottom driver.execute_script("window.scrollTo(0, document.body.scrollHeight);)We can ...

Read More

What are the prerequisites to learn Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 01-Feb-2021 2K+ Views

We shall explore the prerequisites to learn Selenium. First of all, we should know that testing can be divided into two segments − Manual and Automation.For manual testing, it is essential to have the basic understanding of the application that we are going to test, a reasonable acumen and a good documentation skill.For automation testing, we should learn and develop skills on the basic testing along with automation testing concepts. Apart from these, we should have understanding on the below topicss −DatabaseProgramming logicData StructureFront End Development.Now let us see what major topics we should know under the basic testing concepts ...

Read More

How does the Selenium WebDriver work?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 01-Feb-2021 478 Views

The working of Selenium webdriver is described in the below image −Source Img : https://www.tutorialspoint.com/what−is−web−driver−in−seleniumSelenium webdriver contains the below components −Selenium Binding Languages − Selenium can work on more than one language like Java, Python, C#, Ruby, and so on as it has the bindings for all these languages.JSON Wire Protocol − JavaScript Object Notation is called the JSON Wire Protocol. It dispatches data from the server to the page of the client. It is developed on REST API which carries information inside the HTTP servers.Browser Driver − Every browser has a driver with which it establishes communication. As a ...

Read More

What is the difference between mocha and Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 01-Feb-2021 522 Views

The differences between Mocha and Selenium are listed below −VsFunctionalitiesMochaSeleniumPurposeIt is an easy, workable and popular JavaScript framework developed for Node.js.It is a free automation tool used for testing the web.LanguageBased on JavaScript.Can be used with multiple languages like Java, Python, C#, Ruby, JavaScript, and so on.UsageUsed for integration, unit and end to end testing.Used for web based automation testing.XUnit frameworkIt contains the XUnit reporter which yields an XML document.It cannot be used with XUnit Framework.BrowserSupports mostly Chrome and Firefox. It can be used for other browsers with certain challenges.Supports the majority of browsers like Chrome, Firefox, Safari, IE, and ...

Read More
Showing 281–290 of 590 articles
« Prev 1 27 28 29 30 31 59 Next »
Advertisements