Reputation: 11
I am creating the test cases for my learning using Selenium C# in Orange Hrm application. https://enterprise-demo.orangehrmlive.com/auth/login Username and password: admin.
Once I login, there are differen menu, I am traversing through Admin>User Management>users and click on Users. However, I am not getting way to how to use the MouseOver in Selenium C#. Attached is the screenshot for your reference.enter image description here
Upvotes: 1
Views: 418
Reputation: 11
Thank you Jens Stragier for your suggestion. Based on your suggestion, I wrote as follows and it worked for me.
Actions action = new Actions(Driver);
action.MoveToElement(elemWomen);
Thread.Sleep(500);
action.ClickAndHold(elemWomen);
action.Release(TShirt);
action.Click(TShirt);
action.Perform();
Upvotes: 0
Reputation: 223
From my limited knowledge you'll have to do it in a few steps. Below is an example using NgWebDriver (angularJS app)
Actions builder = new Actions(ngDriver);
var elementToHover= ngDriver.FindElement(By.ClassName("dpcontract"));
builder.MoveToElement(elementToHover, 10 , 0)
builder.Build().Perform();
This builds a new action by finding the target element, moving the mouse to its position (x/y) with a 10 offset on the x (in my case).
You can add more events to that action trigger. The original (working) code for a drag and drop type-action i have is this
Actions builder = new Actions(ngDriver);
var elementToClick = ngDriver.FindElement(By.ClassName("dpcontract"));
builder.MoveToElement(elementToClick, elementToClick.Size.Width - 1, 0)
.ClickAndHold()
.MoveByOffset(150, 0)
.Release();
builder.Build().Perform();
Upvotes: 1