I need help i am trying to add two products in cart by clicking over the icon when user hover mouse over the image i am not sure how should i select the image first then hover over to click cart Thank You for help My code:
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("logout-trigger")));
driver.findElement(By.id("search-trigger")).sendKeys(Keys.ENTER);
driver.findElement(By.id("search")).sendKeys("Shampoo");
driver.findElement(By.id("search")).sendKeys(Keys.ENTER);
//Shampoos are displayed now i am going to get any of those and click on checkout
driver.findElement(By.xpath(".//*[@id='product-listing']/grid-view-directive/section/div/div/div/div[1]/div/div[2]/div[6]/a/img")).sendKeys(Keys.ENTER);
Actions actions = new Actions(driver);
WebElement menuHoverLink = driver.findElement(By.xpath(".//*[@id='product-listing']/grid-view-directive/section/div/div/div/div[1]/div/div[2]/div[4]/div/a"));
actions.moveToElement(menuHoverLink);
actions.click();
actions.perform();
HTML code:
For Image
<img class="img-responsive " alt="pClarifying ..."
ng-src="http://ift.tt/2yCtL2X"
ng-image-appear="" no-loader="" responsive="" bg-color="#ffffff"
style="opacity: 1; transition: all 0.7s ease-in-out 0s; animation: 0.7s ease-in-out 0s normal none 1 running zoomIn;"
src="http://ift.tt/2guoLH6">
for icon
<a title="Add to cart" href="javascript:void(0)" ng-mouseover="showgridViewToggle($index+1)"
ng-click="helperService.addToCart('grid_product',prod.productSizeId,$index+1,prod.itemsPerBox)">
<i class="fa fa-shopping-bag faa-shake animated"></i>
</a>
Aucun commentaire:
Enregistrer un commentaire