Debomita Bhattacharjee

Debomita Bhattacharjee

590 Articles Published

Articles by Debomita Bhattacharjee

590 articles

HTTP basic authentication URL with “@” in password

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 04-Mar-2024 68K+ Views

We can do HTTP basic authentication URL with @ in password. We have to pass the credentials appended with the URL. The username and password must be added with the format − https://username:password@URL.Let us make an attempt to handle the below browser authentication.Once the User Name and Password are entered correctly and the OK button is clicked, we should be navigated to the actual page with the text Congratulations! You must have the proper credentials.Syntaxhttps://username:password@URL https://admin:admin@the-internet.herokuapp.com/basic_auth Here, the username and password value is admin. URL is www.the-internet.herokuapp.com/basic_auth Example import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class BrwAuthnPopup{ ...

Read More

Handling Browser Authentication using Selenium

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 04-Mar-2024 6K+ Views

We can handle browser authentication with Selenium webdriver. We have to pass the credentials appended with the URL. The username and password must be added with the format: https://username:password@URL. Let us make an attempt to handle the below browser authentication.Once the User Name and Password are entered correctly and the OK button is clicked, we are navigated to the actual page with the text Congratulations! You must have the proper credentials.Syntaxhttps://username:password@URL https://admin:admin@the−internet.herokuapp.com/basic_authHere, the username and password value is admin.URL is www.the−internet.herokuapp.com/basic_authExampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class BrwAuthnPopup{    public static void main(String[] args) {     ...

Read More

How to find an element using the attribute “class name” in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 08-Nov-2023 26K+ Views

We can find an element using the attribute class name with Selenium webdriver using the locators - class name, css, or xpath. To identify the element with css, the expression should be tagname[class='value'] and the method to be used is By.cssSelector. To identify the element with xpath, the expression should be //tagname[@class='value']. Then, we have to use the method By.xpath to locate it. To locate an element with a locator class name, we have to use the By.className method. Let us look at the html code of an element with class attribute − Syntax WebElement e = driver. findElement(By.className("input")); ...

Read More

Scroll Element into View with Selenium.

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 31-Oct-2023 29K+ Views

We may 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

Typing Enter/Return key in Selenium.

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 31-Oct-2023 29K+ Views

We can type Enter/Return key in Selenium. We shall use the sendKeys method and pass Keys. ENTER as an argument to the method. Also, we can use pass Keys. RETURN as an argument to the sendKeys method for the same purpose.To use the Keys class, we have to incorporate import org.openqa.selenium.Keys to the code. Let us type Enter/Return after inputting text within the below edit box.Exampleimport org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.By; import org.openqa.selenium.Keys; public class TypeEnter{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",       "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ...

Read More

How to resolve exception Element Not Interactable Exception in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 22-Oct-2023 24K+ Views

We can resolve the exception – ElementNotInteractableException with Selenium webdriver. This exception is thrown if a webelement exists in DOM but cannot be accessed. The below image shows an example of such an exception.If a specific webelement is overspread by another webelement we normally get this exception. To fix this, we can either apply explicit wait so that the webdriver waits for the expected condition - invisibilityOfElementLocated of the overlaying webelement.Or, we can apply the expected condition - elementToBeClickable on the webelement that we want to interact with. To resolve a permanent overlay, we have to use the JavaScript Executor ...

Read More

How to use xPath in Selenium WebDriver to grab SVG elements?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 15-Sep-2023 43K+ Views

We can use xpath to grab SVG elements with Selenium Webdriver. A SVG element is identified with tagname svg. The svg image has the attributes like width and height attributes.Let us investigate the html code of a svg element.To create a xpath for a svg element, we have the syntax as //*[local-name()='svg'].The local-name function is mandatory for creating a xpath of a svg element. So for the xpath expression for the image highlighted in the above image should be −//*[local-name()='svg' and @data-icon='home']/*[local-name()='path']Here, data-icon is an attribute of the svg tag element which is added accompanied with @ symbol. The [local-name()='path'] is ...

Read More

Explain JMeter installation in macOS

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

JMeter installation is done in MacOS by following the below steps −Step1 − Navigate to the below URL −https://jmeter.apache.org/download_jmeter.cgiStep2 − Navigate to the section Apache JMeter , then click on the link with the .tgz file(to download) as highlighted below −Step3 − Click on the downloaded file, a folder named: apache-jmeter-5.4.3 gets created. Here, 5.4.3 is the JMeter version. Open the folder, we should have the content as shown below −Step4 − Open Terminal and navigate to the location of the bin folder(which is within the apache-jmeter-5.4.3 folder) and run the below command −sh jmeter.shAfter successfully running the above command, ...

Read More

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
Showing 1–10 of 590 articles
« Prev 1 2 3 4 5 59 Next »
Advertisements