Testing Tools Articles

Page 31 of 52

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

How to get text found between span – Selenium

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

We can get the text found within the span tag with Selenium webdriver.The text of a web element can be captured with the method getText. Let us see an example of an element having the text - © Copyright 2021. All Rights Reserved enclosed within the span tag.SyntaxWebElement l = driver.findElement(By.xpath("//p/span")); String s = l.getText();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 SpanText{    public static void main(String[] args) {       System.setProperty("webdriver.gecko.driver", "C:\Users\ghs6kor\Desktop\Java\geckodriver.exe");       WebDriver driver = new FirefoxDriver();       //implicit wait       driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);       ...

Read More

How to specify "ENTER" button functionality in Selenium WebDriver code?

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

To specify ENTER button functionality in Selenium webdriver we have to use the method sendKeys. To simulate pressing the ENTER button, we have to add the statement import org.openqa.selenium.Keys to our code.Then pass the parameter – Keys.RETURN or Keys.ENTER to the sendKeys method.Let us make an attempt to press the ENTER button after entering some text in the Google search input box −ExampleCode Implementation with Keys.ENTERimport 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.Keys; public class EnterOperation{    public static void main(String[] args) {       System.setProperty("webdriver.gecko.driver", "C:\Users\ghs6kor\Desktop\Java\geckodriver.exe");       WebDriver driver = new FirefoxDriver(); ...

Read More

How to print text from a list of all web elements with same class name in Selenium?

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

We can get the text from a list of all web elements with the same class name in Selenium webdriver. We can use any of the locators like the class name with method By.className, xpath with method By.xpath, or css with method By.cssSelector.Let us verify a xpath expression //h2[@class='store-name'] which represents multiple elements that have the same class name as store-name. If we validate this in Console with the expression - $x("//h2[@class='store-name']"), it yields all the matching elements as shown below:Also, since we need to obtain multiple elements, we have to use the findElements method which returns a list. We ...

Read More

Gecko driver, Selecting value from a dropdown list using Selenium

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 03-Apr-2021 583 Views

We can use the Selenium webdriver scripts in Firefox (versions>47) with the help of the geckodriver.exe executable file. First, we have to download this file from the following link −https://github.com/mozilla/geckodriver/releasesOnce we navigate to the mentioned URL, we have to click a link based on the operating system (Windows, Linux or Mac) we are presently using. As the download gets over, a zip file is created. We have to extract the zip file and store the geckodriver.exe file in a desired location.Then, we have to configure the path of the geckodriver.exe file using the System.setProperty method along with creating an object ...

Read More

What is Scalability Testing?

Vineet Nanda
Vineet Nanda
Updated on 18-Mar-2021 530 Views

What is Scalability Testing and Learn with ExampleA system/application must have the capability to function flawlessly under excessive load. Scalability testing features the process where the efficiency of a system is tested based on a growing number of user requests, data volume, transactions, and user traffic. The developers identify the points where the system stops responding to changes and dig deeper to find its reasons.Salient features of Scalability TestingIt tells you how the application behaves under heavy loadIt let you know the limitation of the app in terms of user experienceIt helps you determine the efficiency and limits of the ...

Read More

Agile Software Process and its Principles?

Vineet Nanda
Vineet Nanda
Updated on 18-Mar-2021 6K+ Views

IntroductionIn case of software engineering, the software development takes a major chunk of the whole process. While Software development itself means dividing the whole development into multiple phases such as designing, product management, project management etc., organizations across the world follow various software development methodologies for successful project management.Various methodologies such as Agile methodologies, Waterfall model, DevOps deployment, Rapid application development etc. used by different organizations and all of them have their own share of pros and cons. However it’s the Agile software development methodology, which is widely used across the globe due to its iterative development approach.What is Agile ...

Read More

How can I scroll a web page using selenium webdriver in python?

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

Sometimes we need to perform action on an element which is not present in the viewable area of the page. We need to scroll down to the page in order to reach that element.Selenium cannot perform scrolling action directly. This can be achieved with the help of Javascript Executor and Actions class in Selenium. DOM can work on all elements on the web page with the help of Javascript.Selenium can execute commands in Javascript with the help of the execute_script() method. For the Javascript solution, we have to pass true value to the method scrollIntoView() to identify the object below ...

Read More

How to Stop the page loading in firefox programmatically in Selenium ?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 02-Feb-2021 500 Views

We can stop the page loading in Firefox programmatically. This can be done by first setting page load time with the help of the pageLoadTimeout method.The time to wait for the page load is passed as a parameter to that method.Syntaxdriver.manage().timeouts().pageLoadTimeout(10, TimeUnit.MILLISECONDS);The page is forced to stop from loading with the help of the Javascript Executor. Selenium executes JavaScript command (window.stop() to stop page load) with the help of the executeScript method.Syntax((JavascriptExecutor)driver).executeScript("window.stop();");Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class StopPageLdWait{    public static void main(String[] args) {       System.setProperty("webdriver.gecko.driver",       "C:\Users\ghs6kor\Desktop\Java\geckodriver.exe");       ...

Read More

Can Google Chrome be supported by Selenium IDE?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 02-Feb-2021 472 Views

Initially Selenium IDE was used as a Firefox plugin. But the latest Selenium IDE version supports both Chrome and Firefox. For installation in Chrome, navigate to the below link −ttps://chrome.google.com/webstore/detail/seleniumide/mooikfkahbdckldjjndioackbalphokdThen click on Add to Chrome.Click on Add extension.Once installed, we shall get the below message as shown in the image −Also an icon gets created in the menu bar.Click on that icon, and the Selenium IDE gets launched with the below welcome screen.

Read More
Showing 301–310 of 517 articles
« Prev 1 29 30 31 32 33 52 Next »
Advertisements