Jump to content

Getting the value of an element when you hover over it


Recommended Posts

Hi guys 

 

I'm trying to get this value where when you hover on insuredname you get the greyed out text of _InsuredName_CCC

137065233_hovertext.png.2204376a4e18a32332a45cf539f181a7.png

If you hover over insured name you get the greyed out box appear. An inspect of the element looks like this

inspect.PNG.e52e14d0889b630a42d37f2b46b50a4f.PNG

I tried trying to get this value using the below but the msgboxs don't return anything (except the value one which correctly returns "insured Name" 

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="mat-input-16"]')
      $ClipData = _WD_ElementAction($sSession, $sElement, 'property', 'innerText')
     ; Msgbox(64, "", "$ClipData equals inner text: " & $ClipData)
      $ClipData = _WD_ElementAction($sSession, $sElement, 'property', 'value')
    ;  Msgbox(64, "", "$ClipData equals value: " & $ClipData)
      $ClipData = _WD_ElementAction($sSession, $sElement, 'property', 'attribute')
     ; Msgbox(64, "", "$ClipData equals value: " & $ClipData)
      $ClipData = _WD_ElementAction($sSession, $sElement, 'property', 'property')
      Msgbox(64, "", "$ClipData equals value: " & $ClipData)
      $ClipData = _WD_ElementAction($sSession, $sElement, 'property', 'css')
     ;; Msgbox(64, "", "$ClipData equals value: " & $ClipData)

      _WD_ElementActionEx($sSession, $sElement, "hover")
      Sleep(500)
      $HoverElement = _WD_GetMouseElement($sSession)
      MsgBox(64, "", "Hover element equals:" & $HoverElement)

So am I using hover incorrectly? As SCITE output seems to point to a success and returning the $HoverElement variable 

_WD_ElementActionEx ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/ceaea31d471dae4572480bc7d1eabb97/execute/sync; $sData={"script":"return Array.from(document.querySelectorAll(':hover')).pop()", "args":[]}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"e47ad604-5fbd-4f2c-a295-483d35d5c635"}}...
_WD_ExecuteScript: {"value":{"element-6066-11e4-a52e-4f735466cecf":"e47ad604-5fbd-4f2c-a295-483d35d5c635"}}...
_WD_GetMouseElement: e47ad604-5fbd-4f2c-a295-483d35d5c635
_WD_GetMouseElement: 0

 

Edited by CaptainBeardsEyesBeard
Link to comment
Share on other sites

Not sure that I understand exactly what you are wanting to do here. Have you compared the element returned by _WD_GetMouseElement to the one from _WD_FindElement?

My general suggestion on this kind of situation is to use the console in the browser's Developer Tools to determine how you can programmatically obtain the desired information. Once you know how to do that, then implement it in Autoit with the necessary webdriver calls.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...