Quality Testing

Quality is delighting customers

How to open sub menu by using mouse hover in Selenium WebDriver?

Learning Basic Level selenium - webdriver

How to open sub menu by using mouse hover.

Views: 193

Reply to This

Replies to This Discussion

The general flow would be something like:

WebElement menuHoverLink = driver.findElement(By.linkText("menu link text"));
  • Use Actions class to hover the menu
Actions actions = new Actions(driver);

actions.moveToElement(menuHoverLink).perform();

WebDriverWait wait = new WebDriverWait(driver,10);wait.until(ExpectedConditions.presenceOfElementLocated(By.linkText("sub menu text")));
  • Now you should be able to click the submenu item
driver.findElement(By.linkText("sub menu text")).click();

Thanks for sharing your knowledge....

How to select the previous month / next month date by using selenium web driver.... i uploaded calender image, which is i am used...please share your script...

Attachments:

As per software testing services company, it's not a good approach to select backdate in the calendar. Most of the application calendar backdate are disabled. But if you need to perform backdate scenario this selenium having minusDays method so you can use these.

So here the code:

For future dates:

public Date incrementDateByDays(int incrementDays) {

      LocalDate newDate = LocalDate.now().plusDays(incrementDays);

      return Date.from(newDate.atStartOfDay(ZoneId.systemDefault()).toInstant());

   }

In Case when you want to choose to backdate replace plusDays with minusDays

e.g.:- LocalDate newDate = LocalDate.now().minusDays(daysToSubtract)

From the above code, you have the future and backdate you have to match this with your current date(Calendar) and iterate till it matches the calendar date.

If need more details please share the web address(or similar calendar on another web if you have) where you want to perform this action.

Thanks for sharing your knowledge Mr. Anand Singh.

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2019   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service