How can I automate the process of adding a product to cart in Flipkart

0 votes
I am trying to add a product to my cart in Flipkart. Can someone help me with this project of mines?
Dec 20, 2018 in Selenium by Jino
• 5,820 points
13,698 views

2 answers to this question.

+1 vote

Hey @Jino, it was pretty good brain storming thing to do, eventually got a solution. Please let me know as whether it worked for you or not?

driver.findElement(By.className("LM6RPg")).sendKeys("comb");
driver.findElement(By.className("col-1-12")).click();
Thread.sleep(3000);
driver.findElement(By.xpath("//*[@id='container']/div/div[1]/div[2]/div/div[1]/div[2]/div[2]/div/div[1]")).click();
ArrayList<String> tabs2 = new ArrayList<String> (driver.getWindowHandles());
    driver.switchTo().window(tabs2.get(0));
    driver.close();
    driver.switchTo().window(tabs2.get(1));
Thread.sleep(6000);
try
{
     driver.navigate();
     driver.findElement(By.xpath("//*[@id='container']/div/div[1]/div[2]/div/div[1]/div[1]/div[2]/div/ul/li[1]/button")).click();
}
catch (Exception e)
{
System.out.println(e);
}
driver.close();

I added a comb in my cart. I assume that you have already logged in.

You can view the way to login here:

https://www.edureka.co/community/33814/how-can-i-login-to-flipkart-using-selenium

answered Dec 21, 2018 by Nabarupa
0 votes
The above article on "How can I automate the process of adding a product to cart in Flipkart?" seems to be more informative. This is more helpful for our <a href="https://www.zuaneducation.com/selenium-training-chennai">selenium training in chennai</a> Thanks for sharing
answered May 20, 2019 by Zuan Education

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,219 views
+1 vote
1 answer
0 votes
1 answer

Automate a purchase by adding a book to the cart in flipkart using Selenium

Hello Junaid, this code snippet would help you ...READ MORE

answered May 22, 2019 in Selenium by Abha
• 28,140 points
6,222 views
0 votes
1 answer

How to capture the status change of a process in selenium, after the process is kickstarted(Run)

For your requirement of capturing and displaying ...READ MORE

answered Apr 14, 2020 in Selenium by Jake George
3,051 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,476 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,026 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,141 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,815 views
0 votes
1 answer

How to check the state of a radio button or checkbox in Selenium?

Hey Priya, to check the state of ...READ MORE

answered May 7, 2019 in Selenium by Pratibha
• 3,690 points
4,502 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
197,421 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