How can I login to flipkart using selenium

0 votes
I am working with selenium webdriver and its fun till now. I am trying to login to flipkart now and its pretty mess there. I am unable to get an ID there and locating elements using class name is also not working. Can someone help me with this?
Dec 20, 2018 in Selenium by Jino
• 5,820 points
13,791 views

1 answer to this question.

0 votes

Hey @Jino, glad you are liking selenium but there are many more things to selenium. Anyways, you can use different types of locators to find element.

Here is what I used the basic one using Xpath, take a look.

driver.get("https://www.edureka.co");
driver.findElement(By.className("_2zrpKA")).sendKeys("email@gmail.com");
driver.findElement(By.xpath("/html/body/div[2]/div/div/div/div/div[2]/div/form/div[2]/input")).sendKeys("pa55word");
driver.findElement(By.xpath("/html/body/div[2]/div/div/div/div/div[2]/div/form/div[3]/button")).click();

Try this, it works. 

answered Dec 20, 2018 by Nabarupa
package Webbasics;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

public class FlipkartLogin {

public static void main(String[] args) {

// TODO Auto-generated method stub

System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\selenium\\chromedriver.exe");

WebDriver driver=new ChromeDriver();

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

driver.get("https://www.flipkart.com");

driver.manage().window().maximize();

driver.findElement(By.xpath("(//input[@type='text'])[2]")).sendKeys("bhargav@gmail.com");

driver.findElement(By.xpath("//input[@type='password']")).sendKeys("Bhargav");

driver.findElement(By.xpath("(//button[@type='submit'])[2]")).click();

}

}
Hi M Bhargav, thanks for sharing the solution for this problem. It worked well for me.

Related Questions In Selenium

+1 vote
1 answer

How can I automate the process of adding iPhone to cart in Flipkart using Selenium(java),Page Object Model and TestNG? Also validate if product is added and available in cart?

Hey check this https://www.edureka.co/community/47160/automate-purchase-adding-book-cart-flipkart-using-selenium? It deals with a similar ...READ MORE

answered Jan 13, 2020 in Selenium by Karan
• 19,610 points
8,395 views
0 votes
1 answer

How can I send some data to a Prompt Alert box using Selenium Webdriver?

Hey Abhishek, you can use sendKeys() method ...READ MORE

answered Jul 3, 2019 in Selenium by Abha
• 28,140 points
9,589 views
0 votes
1 answer

How can I download the *.jar file from http:// seleniumhq.org using selenium WebDriver?

For Selenium Standalone Server use this: profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/java-archive"); and ...READ MORE

answered Apr 9, 2018 in Selenium by Martin
• 4,320 points
3,574 views
0 votes
1 answer

How can I implement Selenium using C#?

Reference https://www.seleniumhq.org/docs/03_webdriver.jsp#the-5-minute-getting-started-guide using OpenQA.Selenium.Firefox; using OpenQA.Selenium; class GoogleSuggest { ...READ MORE

answered Apr 9, 2018 in Selenium by Neville
948 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,771 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,187 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,262 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,901 views
+10 votes
17 answers

How to automate gmail login process using selenium webdriver in java?

Check the below code: Here is the working ...READ MORE

answered Apr 24, 2018 in Selenium by Vardy
• 2,360 points
198,271 views
+4 votes
1 answer

How can I configure Eclipse for using Selenium?

Follow the following steps to configure your ...READ MORE

answered Dec 12, 2018 in Selenium by Nabarupa
1,905 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP