Jump to content

Recommended Posts

Posted

Hello,
I'm using https://www.autoitscript.com/wiki/WebDriver and it works fine with Chrome and AUTOIT.

#include "wd_helper.au3"
#include "wd_capabilities.au3"


On Cisco ISE webpage, you enter username, password and then must select between (AD or Internal) as login method.
image.thumb.png.26307339a905c70796a74e7ad9ce2b66.png

The user and Password are OK, but it seems I can't interact and choose between (AD:MYAD or Internal). No matter what I do, in the end it does nothing (it does not interact with DropMenu/Internal to choose from).


----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

This is how it looks by default AD:MYAD
image.thumb.png.26307339a905c70796a74e7ad9ce2b66.png

<table class="dijit dijitReset dijitInline dijitLeft dijitDownArrowButton dijitSelectFixedWidth myClass xwtDropDown dijitSelect" dojoattachpoint="_buttonNode,tableNode" cellspacing="0" cellpadding="0" wairole="presentation" dojoattachevent="onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse" role="presentation" widgetid="authTypeId" style="width: 192px; margin-left: 5px;"><tbody wairole="presentation" role="presentation"><tr wairole="presentation" role="presentation"><td class="dijitReset dijitStretch dijitButtonContents dijitButtonNode" dojoattachpoint="focusNode" wairole="combobox" waistate="haspopup-true" role="combobox" aria-haspopup="true" id="authTypeId" tabindex="0" aria-valuenow="AD:MYAD"><span class="dijitReset dijitInline dijitButtonText" dojoattachpoint="containerNode,_popupStateNode" popupactive="true" style="width: 277px;"><span style="width:277px;" class="dijitReset dijitInline xwtDropDown dijitSelectLabel">AD:MYAD</span></span><input type="hidden" name="authType" dojoattachpoint="valueNode" value="AD:MYAD" waistate="hidden-true" aria-hidden="true">
        </td><td class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonActive" dojoattachpoint="titleNode" wairole="presentation" role="presentation"><div class="dijitReset dijitArrowButtonInner" wairole="presentation" role="presentation"> </div><div class="dijitReset dijitArrowButtonChar" wairole="presentation" role="presentation">▼</div></td></tr></tbody></table>

               

//*[@id="authTypeId"] //*[@id="authTypeId"]/span/span //*[@id="authTypeId"]/input  //*[@id="dijit_MenuItem_0_text"]

<td class="dijitReset dijitStretch dijitButtonContents dijitButtonNode" dojoattachpoint="focusNode" wairole="combobox" waistate="haspopup-true" role="combobox" aria-haspopup="true" id="authTypeId" tabindex="0" aria-valuenow="AD:MYAD"><span class="dijitReset dijitInline dijitButtonText" dojoattachpoint="containerNode,_popupStateNode" popupactive="true" style="width: 277px;"><span style="width:277px;" class="dijitReset dijitInline xwtDropDown dijitSelectLabel">AD:MYAD</span></span><input type="hidden" name="authType" dojoattachpoint="valueNode" value="AD:MYAD" waistate="hidden-true" aria-hidden="true">
        </td>
        
        
<span style="width:277px;" class="dijitReset dijitInline xwtDropDown dijitSelectLabel">AD:MYAD</span>


<input type="hidden" name="authType" dojoattachpoint="valueNode" value="AD:MYAD" waistate="hidden-true" aria-hidden="true">


<td class="dijitReset dijitMenuItemLabel" colspan="2" dojoattachpoint="containerNode" id="dijit_MenuItem_0_text">AD:MYAD</td>
 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

If I change it manually to Internal I get:

image.png.2b09f2947a084794d88d301a2cfad75c.png
<table class="dijit dijitReset dijitInline dijitLeft dijitDownArrowButton dijitSelectFixedWidth myClass xwtDropDown dijitSelect" dojoattachpoint="_buttonNode,tableNode" cellspacing="0" cellpadding="0" wairole="presentation" dojoattachevent="onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse" role="presentation" widgetid="authTypeId" style="width: 192px; margin-left: 5px;"><tbody wairole="presentation" role="presentation"><tr wairole="presentation" role="presentation"><td class="dijitReset dijitStretch dijitButtonContents dijitButtonNode" dojoattachpoint="focusNode" wairole="combobox" waistate="haspopup-true" role="combobox" aria-haspopup="true" id="authTypeId" tabindex="0" aria-valuenow="Internal"><span class="dijitReset dijitInline dijitButtonText" dojoattachpoint="containerNode,_popupStateNode" popupactive="true" style="width: 277px;"><span style="width:277px;" class="dijitReset dijitInline xwtDropDown dijitSelectLabel">Internal</span></span><input type="hidden" name="authType" dojoattachpoint="valueNode" value="Internal" waistate="hidden-true" aria-hidden="true">
        </td><td class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonActive" dojoattachpoint="titleNode" wairole="presentation" role="presentation"><div class="dijitReset dijitArrowButtonInner" wairole="presentation" role="presentation"> </div><div class="dijitReset dijitArrowButtonChar" wairole="presentation" role="presentation">▼</div></td></tr></tbody></table>

 

//*[@id="authTypeId"] //*[@id="authTypeId"]/span/span //*[@id="authTypeId"]/input //*[@id="dijit_MenuItem_1_text"]


<td class="dijitReset dijitStretch dijitButtonContents dijitButtonNode" dojoattachpoint="focusNode" wairole="combobox" waistate="haspopup-true" role="combobox" aria-haspopup="true" id="authTypeId" tabindex="0" aria-valuenow="Internal"><span class="dijitReset dijitInline dijitButtonText" dojoattachpoint="containerNode,_popupStateNode" popupactive="true" style="width: 277px;"><span style="width:277px;" class="dijitReset dijitInline xwtDropDown dijitSelectLabel">Internal</span></span><input type="hidden" name="authType" dojoattachpoint="valueNode" value="Internal" waistate="hidden-true" aria-hidden="true">
        </td>
        
<span style="width:277px;" class="dijitReset dijitInline xwtDropDown dijitSelectLabel">Internal</span>

<input type="hidden" name="authType" dojoattachpoint="valueNode" value="Internal" waistate="hidden-true" aria-hidden="true">


<td class="dijitReset dijitMenuItemLabel" colspan="2" dojoattachpoint="containerNode" id="dijit_MenuItem_1_text">Internal</td>


----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I was able to do it and select the value with Python using from selenium, but no look with AUTOIT

# -------------------- SELECT AUTH TYPE (Dojo) --------------------
# Click the dropdown
wait.until(EC.element_to_be_clickable((By.ID, "authTypeId"))).click()

# Wait for the menu items to appear
wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.dijitMenu")))

# Click the correct auth type
menu_item = wait.until(EC.element_to_be_clickable(
    (By.XPATH, f"//tr[contains(@class,'dijitMenuItem') and .//td[text()='{auth_type}']]")
))
menu_item.click()

 


 

image.png

  • 2 weeks later...
Posted

Ok and what did you have for AU3 code?  AI will transform your code to a starting point on how to do it from AutoIt
 

; -------------------- SELECT AUTH TYPE (Dojo) --------------------

; 1. Click the dropdown
; We use 'True' for the $bVisible and $bClick parameters in the wait function
Local $sDropdown = _WD_WaitElement($sSession, $_WD_LOCATOR_ByID, "authTypeId", 0, 10000, $True)
_WD_ElementAction($sSession, $sDropdown, 'click')

; 2. Wait for the menu items to appear (dijitMenu)
_WD_WaitElement($sSession, $_WD_LOCATOR_ByCSS_Selector, "div.dijitMenu", 0, 5000)

; 3. Click the correct auth type using XPath
; Note: $auth_type should be defined as a variable beforehand
Local $sXPath = "//tr[contains(@class,'dijitMenuItem') and .//td[text()='" & $auth_type & "']]"
Local $sMenuItem = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, $sXPath, 0, 5000, $True)
_WD_ElementAction($sSession, $sMenuItem, 'click')

 

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
×
×
  • Create New...