Forum Discussion
jmcpeek
12 years agoContributor
I had a similar situation with some global navigation. We have a header bar with a Logout link, but I didn't want to have to map it for every page. What I ended up doing was creating a function that just looks for the logout link on whatever page is loaded. My function is below, if it can help you. If yours is a menu, you could just have it accept a parameter of what menu item to select and pass that in to the arrValues array instead of my "Logout".
function logout()
call aliases.browser.page("*").Wait
delay 3000
arrProps = array("objecttype", "contenttext", "visible")
arrValues = array("link", "Logout", true)
set logoutLink = aliases.browser.find(arrProps, arrValues, 9, true)
if not logoutLink is nothing then
logoutLink.click
logout = true
else
delay 5000, "Waiting for logout link"
set logoutLink = aliases.browser.find(arrProps, arrValues, 9, true)
if not logoutLink is nothing then
logoutLink.click
logout = true
else
log.message "Failed to find the logout link"
logout = false
end if
end if
end function