Could not hover over Bar Graph icon. | Selenium Webdriver Tutorial with c# |Selenium C# training
10% July Month Discount Avail now

Selenium C# Training Forum

Could not hover over Bar Graph icon.

V
Vrushali Haldankar Post on 11/06/2019

Dear Team,

# MY script could not hover over  Bar Graph .. so cannot view Overlay Matrix.

# I am getting the element of Bar Graph.. so test step is PASS .. (there is no exception like NoSuchElementException, ElementNotClickableException)

# but webdriver code could not hover over Bar Graph..so could not capture next element.

# I am struggling for 2 weeks.

# Project  UI Developer also tried by adding new attribute value.. but that also not work

 # Kindly suggest any other code for hover over

 # Or is there any UI property changes required..so my code can hover over Bar Graph.

 

when i hover over Bar Graph icon.. cannot view 'Overlay Matrics'

Approach 1

Point point = m_page.Maint_Overlay.Location;
int xcord = point.X;
int ycord = point.Y;
Console.WriteLine(xcord + " " + ycord);
Actions act = new Actions(driver);
act.MoveToElement(m_page.Maint_Overlay).ClickAndHold().Build().Perform();
act.MoveByOffset(657,110).ClickAndHold().Build().Perform();

 


Approach 2

IJavaScriptExecutor js;
js = driver as IJavaScriptExecutor;
js.ExecuteScript("arguments[0].click();", m_page.Maint_Overlay);

 

A

Instructor

Ashish Reply on 12/06/2019

Can you tell me what is the exact scenario.

 

From the code as seen on the two lines below, 

act.MoveToElement(m_page.Maint_Overlay).ClickAndHold().Build().Perform();
act.MoveByOffset(657,110).ClickAndHold().Build().Perform();

I can understand that you have a element m_page.Maint_Overlay, and on this element you are performing a incomplete action click and hold. After click and hold you need to add some other action as well. For example .movebyoffset . for the action to be complete.