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,560 points
1,519 views

2 answers to this question.

0 votes

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 20, 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 by Zuan Education

Related Questions In Selenium

+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

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,110 points
1,006 views
0 votes
1 answer
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,130 points
1,153 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
891 views
0 votes
1 answer
+9 votes
15 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,270 points
71,712 views