Reputation: 104
My code
class="dropdown-toggle doTransition ng-binding"
ng-mouseenter="recentList(null,key,0)"
ng-click="ga('send', 'event', 'Menu', 'Click', topNav.title);"
href="/television">
class="dropdown-toggle doTransition ng-binding"
ng-mouseenter="recentList(null,key,0)"
ng-click="ga('send', 'event', 'Menu', 'Click', topNav.title);"
href="/bollywood">
I want to have a mouse over action using href. Can anyone suggest me what can be done? Is XPath the only way you can find element?
Upvotes: 0
Views: 726
Reputation: 5113
Is XPath the only way you can find element?
The By
class shows you can find elements by:
id
(attribute)name
attributeUpvotes: 0
Reputation: 50819
You can use cssSelector
to find the element and Actions to do the hovering
C# code, syntax is similar in all languages
IWebElement element = driver.FindElement(By.CssSelector("[href*='television']"));
Actions actions = new Actions(driver);
actions.MoveToElement(element).Build().Perform();
element
will be an web element witch contains "television" in its href
Upvotes: 1