Jump to content

how to click on menu/options websites


Recommended Posts

To start you up :

Local $oIE = _IECreate("https://www.fhlbny.com/")
  $oTags = _IETagNameGetCollection ($oIE, "a")
  For $oTag in $oTags
    If $oTag.innerText = "ABOUT US" Then
      ConsoleWrite ("found" & @CRLF)
      ExitLoop
    EndIf
  Next
  $oTag.click ()

 

Link to comment
Share on other sites

#include "wd_core.au3"
#include "wd_helper.au3"
Local $sDesiredCapabilities, $sSession
SetupChrome()
_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, "https://www.fhlbny.com")
$lPartial = True
$sText="menu-item-5075"
_WD_LinkClickByText($sSession, $sText, $lPartial)

Func SetupChrome()
_WD_Option('Driver', 'chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}'
EndFunc

Func _ChromeSetInputValueById($sSession, $Id, $Value)
    $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$Id&"']")
    _WD_ElementAction($sSession, $sButton, 'value', $Value)
EndFunc

Capture4.PNG

Link to comment
Share on other sites

@tak09 Please reread my earlier post, which explains how to properly post code on the forum. It also requests that you post text and not a screenshot when possible. :rolleyes:

As far as your current issue, "menu-item-5075" is the id for a completely different element. That function is designed to search for the link's text. Therefore, you want to use something like this --

_WD_LinkClickByText($sSession, "ABOUT US")

 

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...