Selenium Testing xpath

zafar ahmad :

Hey i need this xpath for list

enter image description here

enter image description here

KunduK :

You need to first click on My Account link and then need to click Login or Sign Up link.

Induce WebDriverWait and elementToBeClickable with following xpath.

To click on Login link

Click on My Account

WebDriverWait wait = new WebDriverWait(driver, 30);
WebElement eleMyaccount = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@class='collapse navbar-collapse']//ul//li[@id='li_myaccount']//a[contains(.,'My Account')]//i")));
eleMyaccount.click()

Click on Login link

WebElement eleLogin = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@class='collapse navbar-collapse']//ul[@class='dropdown-menu']//li//a[contains(.,'Login')]")));
eleLogin.click()

To click on Sign Up link

Click on My Account

WebDriverWait wait = new WebDriverWait(driver, 30);
WebElement eleMyaccount = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@class='collapse navbar-collapse']//ul//li[@id='li_myaccount']//a[contains(.,'My Account')]//i")));
eleMyaccount.click()

Click on Sign Up link

WebElement eleSignUp = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@class='collapse navbar-collapse']//ul[@class='dropdown-menu']//li//a[contains(.,'Sign Up')]")));
eleSignUp.click()

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=162463&siteId=1