Debomita Bhattacharjee

Debomita Bhattacharjee

590 Articles Published

Articles by Debomita Bhattacharjee

Page 3 of 59

Using XPATH to search text containing &nbsp

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 08-Feb-2022 16K+ Views

We can use the locator xpath to identify elements having search text with   or spaces. Let us first examine the html code of a web element having trailing and leading spaces. In the below image, the text JAVA BASICS with tagname strong has spaces as reflected in the html code.If an element has spaces in its text or in the value of any attribute, then to create an xpath for such an element we have to use the normalize-space function. It removes all the trailing and leading spaces from the string. It also removes every new tab or lines ...

Read More

How to get rid of Firefox logging in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 08-Feb-2022 2K+ Views

After the execution of tests, there are logs generated because of Firefox logging in with geckodriver. This log generation by Firefox can be disabled by certain parameters setting.We can stop these logs from being recorded in the console and capture them in a different file. This is achieved with the help of the System.setProperty method. In the above image, we can see the geckodriver logs generated in the console.SyntaxSystem.setProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE, "true"); // turning off logs System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, ""); // record logs in another fileExampleimport 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 LogsDisable{    public static void main(String[] ...

Read More

What is Rest Assured?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 08-Feb-2022 12K+ Views

Rest Assured is used to verify the REST APIs with the help of the Java library. Java library acts like a headless client to act upon the Rest web services. The libraries based on the Rest Assured library are also capable of validating the HTTP responses from the server.Response status code, body, message, headers, and so on can be tested with the Rest Assured library. It can be integrated with build tools like Maven, unit test frameworks like JUnit and TestNG. It has an efficient matching mechanism with which we can verify the expected results.Application Programming Interface or API acts ...

Read More

How to create record and playback scripts in JMeter using the Chrome browser?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 08-Feb-2022 3K+ Views

We can create record and playback scripts in JMeter using the Chrome browser with the help of the BlazeMeter extension. To get the extension, navigate to the below link −https://chrome.google.com/webstore/detail/blazemeter-thecontinuous/ mbopgmdnpcbohhpnfglgohlbhfongabi?hl=enThen click on Add to Chrome.After BlazeMeter has been added to our Chrome browser, it should appear on the menu bar. For time users, click on the Signup button.Next, we have to give user details for the registration. After successful registration, if we now click on the BlazeMeter icon on the menu bar, we shall see the input field to enter the test name, recording options(start, pause, and so on). ...

Read More

How to obtain the tagname of the parent element in Selenium webdriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 22-Nov-2021 3K+ Views

We can obtain the tagname of the parent element in Selenium webdriver. First of all, we need to identify the child element with help of any of the locators like id, class, name, xpath, or CSS. Then we have to identify the parent with the findElement(By.xpath()) method.We can identify the parent from the child, by localizing it with the child and then passing (parent::*) as a parameter to the findElement(By.xpath()). Next, to get the tagname of the parent, we have to use the getTagName() method.Syntaxchild.findElement(By.xpath("parent::*"));Let us identify tagname of the parent of child element li in the below html code ...

Read More

How to obtain the page title using Selenium webdriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 22-Nov-2021 10K+ Views

We can obtain the page title using Selenium webdriver. The method getTitle() is used to obtain the present page title and then we can get the result in the console.Syntaxt = driver.getTitle();Let us find the title of the current page. We shall get About Careers at Tutorials Point – Tutorialspoint as output.ExampleCode Implementation.import 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 PageTitle{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",       "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       //implicit wait       driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);       WebDriver driver = new ChromeDriver(); ...

Read More

How to upload files using Selenium Webdriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 22-Nov-2021 5K+ Views

We can upload files using Selenium Webdriver. This is achieved by the sendKeys method. We have to first identify the element which performs the file selection by mentioning the file path [to be uploaded].This is only applied to an element having a type attribute set to file as a value along with the element tag name as input. The below html code shows the element with type = file value set.ExampleCode Implementation.import 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 WndsFileUpl{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",       "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");   ...

Read More

Selenium WebDriver With Java Quickstart.

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 22-Nov-2021 839 Views

We can work with Selenium webdriver with Java Quickstart template. This can be done by following the below steps −Step1− Click on the File menu in Eclipse. Then select the option New. Next click on Other.Step2− Click on Maven Project from the Maven folder. Then click on Next.Step3− Proceed with the further steps.Step4− Select maven-archetype-quickstart template. Then click on Next.Step5− Add GroupId as Selenium, Artifact Id as Automation-Selenium, and proceed.Step6− A project should get created with an archetype project structure. The Selenium-related scripts should be written within the src/test/java folder.

Read More

How to run tests using a test runner file for Cucumber?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 22-Nov-2021 18K+ Views

We can run tests using a test runner file for Cucumber. The test runner file should contain the path of the feature file and step definition file that we want to execute.Code Implementation of the Feature fileFeature − Login ModuleScenario − Welcome Page Login verificationGiven User is on Welcome PageThen Welcome page should be displayedExampleCode Implementation of step definition filepackage stepDefinations; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; public class stepDefination {    @Given("^User is on Welcome Page$")    public void user_on_welcome_page() {       System.out.println("User on welcome page");    }    @Then("^Welcome page should be displayed$")    public void verify_user_on_welcome_page() {   ...

Read More

How to map a step definition to a feature file in Cucumber?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 22-Nov-2021 5K+ Views

We can map a step definition file to a feature file in Cucumber. This can be done using the below steps −Step1− Create a feature file with .feature extension(say Login.feature) with the following −Feature − Login ModuleScenario − Welcome Page Login verificationGiven User is on Welcome PageThen Welcome page should be displayedStep2− Create a step definition java file(say stepDefination.java) having the mapping of the step definition file to the feature file.Examplepackage stepDefinations; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; public class stepDefination { @Given("^User is on Welcome Page$") public void user_on_welcome_page() { ...

Read More
Showing 21–30 of 590 articles
« Prev 1 2 3 4 5 59 Next »
Advertisements