i am going to below email URL : https://www.shopclues.com/wholesale.html after that i am going to this path. ---> Sports&more is first mouseover Click weights gainers after clicking weight gainers it is taking me to another page, where i cannot select any product to add it to cart. I am able to find the exact xpath but still no use. Click first item to add to cart(not able to do this action)
this is the code i tried:- public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver","C:\\course\\dri\\chromedriver.exe");
WebDriver cr = new ChromeDriver();
cr.get("https://www.shopclues.com/wholesale.html");
Thread.sleep(2000);
WebElement category = cr.findElement(By.xpath("//li[@id=\"nav_45\"]"));
Actions act = new Actions(cr);
Thread.sleep(3000);
act.moveToElement(category).perform();
WebElement subcategory = cr.findElement(By.xpath("//a[text()='Weight Gainers']"));
subcategory.click();
[I am stuck here.]
Thread.sleep(2000);
WebElement wanted = cr.findElement(By.xpath("//img[@id=\"det_img_11517942\"]"));
wanted.click();
Thread.sleep(2000);
WebElement addingcard =cr.findElement(By.xpath("//button[@id=\"add_cart\"]"));
addingcard.click();
Comments
Post a Comment