How to automate dynamically changing images

0 votes

I am trying to automate myntra.com Under the Men category, Inside Fashion accessories, select Phone Cases. After clicking Phone Cases, i want to select 3rd row 1st item but these images are dynamically changing. so how to select 3rd row 1st item after changing an image.

Code is:

Actions actions = new Actions(driver);

WebElement menTab = driver.findElement(By.xpath("//a[text()='Men']"));

actions.moveToElement(menTab).perform();

WebElement phonecaseTab = driver.findElement(By.xpath("//*[@id="desktop-header-cnt"]/div[2]/nav/div/div[1]/div/div/div/div/li[5]/ul/li[11]/a"));

new WebDriverWait(driver, 30).until(ExpectedConditions.visibilityOf(phonecaseTab));

actions.moveToElement(phonecaseTab).click().perform();

driver.findElement(By.xpath("//img[contains(@title,'CelfieDesign Turquoise Blue & Black')]")).click();

Jan 8, 2021 in Selenium by Praveen

edited Mar 4 23 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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