问题
To create gmail account with imacros i have completed everything but getting problem only with month, i have tried a lots but can not select month with imacros.
http://i.stack.imgur.com/nBoDI.jpg
The codes for the month are as:
<div class="goog-menu goog-menu-vertical" aria-haspopup="true" role="listbox">
<div id=":1" style="-moz-user-select: none;" role="option" class="goog-menuitem"><div class="goog-menuitem-content">January</div></div>
<div id=":2" style="-moz-user-select: none;" role="option" class="goog-menuitem"><div class="goog-menuitem-content">February</div></div>
I have tried the following code:
TAG POS=1 TYPE=DIV FORM=ID:createaccount ATTR=ROLE:listbox CONTENT=#3
TAG POS=1 TYPE=DIV ATTR=TXT:July CONTENT=#3
It is clicking on the month button but not selecting any month.
Could anyone help me to sort out this problem?
回答1:
Try the following code:
SET monthNum 7
SET monthSlc EVAL("var s = '{{monthNum}}'; switch ('{{monthNum}}') {case '10': s = 'a'; break; case '11': s = 'b'; break; case '12': s = 'c'; break;} '#\\\\:' + s + '>DIV';")
SET listSlc "#BirthMonth>DIV>DIV:nth-of-type(2)"
EVENT TYPE=MOUSEDOWN SELECTOR={{listSlc}} BUTTON=0
EVENT TYPE=MOUSEUP SELECTOR={{listSlc}} BUTTON=0
EVENT TYPE=MOUSEDOWN SELECTOR={{monthSlc}} BUTTON=0
EVENT TYPE=MOUSEUP SELECTOR={{monthSlc}} BUTTON=0
By analogy with the 'Month' field, try to set the gender in this way:
' e - Female, f - Male, g - Other
SET gender f
SET genderSlc #\:{{gender}}>DIV
EVENT TYPE=CLICK SELECTOR="#Gender>DIV" BUTTON=0
EVENT TYPE=CLICK SELECTOR={{genderSlc}} BUTTON=0
回答2:
If normal recording fails, experimental fails try XPATH http://wiki.imacros.net/XPATH .
Use addons for XPATH.
回答3:
I just wanted to add to this the current way to do this since the gmail account form has changed since 3 years ago. The image I have attached is dated 11/1/2018. The gender and the month are still dropdowns just like it's shown in the question by OP's image. The following code works with the gmail form I pulled up today:
TAG POS=1 TYPE=SELECT ATTR=ID:gender CONTENT=3
TAG POS=1 TYPE=SELECT ATTR=ID:month CONTENT=3
The #3 for CONTENT is just the option number to select. You can change that accordingly.
Hope it helps others looking for a current answer.
来源:https://stackoverflow.com/questions/32098572/need-help-to-select-month-in-gmail-account-with-imacros