Selenium Articles

Found 362 articles

Retweet Tweet using Selenium in Python

Prince Yadav
Prince Yadav
Updated on 27-Feb-2025 617 Views

Python has become one of the most popular programming languages, renowned for its versatility and extensive libraries. When it comes to automating web tasks, Python offers a powerful tool called Selenium. Selenium allows us to interact with web browsers programmatically, making it an excellent choice for automating tasks like retweeting tweets on platforms like Twitter. By using both Python and Selenium, we can streamline our web browsing experience and effortlessly engage with the content we find interesting. In this tutorial, we will explore the fascinating world of retweeting tweets using Selenium in Python. Throughout the article, we will guide you ...

Read More

Scrape LinkedIn Using Selenium And Beautiful Soup in Python

Prince Yadav
Prince Yadav
Updated on 27-Feb-2025 1K+ Views

Python has emerged as one of the most popular programming languages for web scraping, thanks to its rich ecosystem of libraries and tools. Two such powerful libraries are Selenium and Beautiful Soup, which, when combined, provide a robust solution for scraping data from websites. In this tutorial, we will delve into the world of web scraping with Python, specifically focusing on scraping LinkedIn using Selenium and Beautiful Soup. In this article, we will explore the process of automating web interactions using Selenium and parsing HTML content with Beautiful Soup. Together, these tools enable us to scrape data from LinkedIn, the ...

Read More

Getting console.log output from Chrome with Selenium Python API bindings.

Akshitha Mote
Akshitha Mote
Updated on 22-Jan-2025 6K+ Views

We can get console.log output from Chrome with Selenium Python API bindings. We will perform this with the DesiredCapabilities class. We shall enable logging from the browser with DesiredCapabilities.Chrome setting. We have to pass this browser capability to the driver object by passing it as a parameter to the Chrome class. To enable logging we shall set the property goog:loggingPrefs of the browser to 'browser':'ALL'. Syntax Syntax:dc = DesiredCapabilities.CHROME dc['goog:loggingPrefs'] = { 'browser':'ALL' } driver = webdriver.Chrome(desired_capabilities=dc) Example from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities #set browser log dc = DesiredCapabilities.CHROME dc['goog:loggingPrefs'] = { 'browser':'ALL' } driver ...

Read More

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

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

Element Methods in Selenium Python

Jaisshree
Jaisshree
Updated on 23-Aug-2023 805 Views

Selenium, an open source automation testing tool is used with other programming scripts like python , java , javascript and pearl to test web applications. It is widely used by developers for automation testing. Element Methods of Selenium 1. send_keys () − Used for setting up input text boxes which includes edit box, text area, fields inside forms and modifier keys. It extends properties from the keys class. Return Type − null 2. is_selected() − Checks if an element is selected or not by the user Return Type − boolean value ( True or False). 3. is_displayed() − Checks ...

Read More
Showing 1–10 of 362 articles
« Prev 1 2 3 4 5 37 Next »
Advertisements