- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to automate instagram login page using java in selenium?
We can automate Instagram login page with Selenium webdriver in Java. To achieve this, first we have to launch the Instagram login page and identify the elements like email, password and login with the findElement method and interact with them.
Let us have the look at the Instagram login page −
Code Implementation
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.By; public class InstagramLogin{ 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); //URL launch driver.get("https://www.instagram.com/"); //identify username WebElement l = driver . findElement(By.name("username")); l.sendKeys("test@gmail.com"); //identify password WebElement p = driver .findElement(By.name("password")); p.sendKeys("test123"); WebElement b = driver .findElement(By.className("Igw0E")); b.click(); //obtain value entered for username String s = l.getAttribute("value"); System.out.println("Value entered for username: " + s); //quit browser driver.quit(); } }
Output
- Related Articles
- How to automate gmail login process using selenium webdriver in java?
- How to automate drag & drop functionality using Selenium WebDriver Java?
- How to automate google Signup form in Selenium using Python?
- How to automate Calendar using Selenium WebDriver for Testing?
- How to scroll the Page up or down in Selenium WebDriver using java?
- Get page title with Selenium WebDriver using Java.
- How to get content of entire page using Selenium?
- How to obtain the page title using Selenium webdriver?
- How to set Page Load Timeout using C# using Selenium WebDriver?
- How to automate menu box/pop up of right click in Python Selenium?
- How to get page source as it is in browser using selenium?
- How to scroll up/down a page using Actions class in Selenium?
- How to use Selenium Web Driver and JavaScript to Login any website?
- How to get the total number of checkboxes in a page using Selenium?
- How to check if an image is displayed on page using Selenium?

Advertisements