element selection issue with html dom

Get help with using AutoHotkey and its commands and hotkeys
glen

element selection ahk html dom

21 Jul 2018, 17:05

What I am trying to do is have my code click on text that is in a drop down menu.

I wish I could show you the html code I am referring to but I cannot figure out how to copy and paste from the DOM explorer. I tried downloading the html file and editing it but the formatting was so awful I'd have to spend a long time just to make it readable. I typed up some here.

Code: [Select all] [Download] GeSHi © Codebox Plus

<li class="header-menu-level-list-item">
<a class="" data-action="setAgency" data-id="2010">some text here</a>
</li>


I don't know if I have to tell ahk to open up the drop down menu first and then click on the text, or if I can just somehow click on the text without doing that. Manually, I have to click an icon to have the menu appear, and then I click on the text.

I can't figure out how to click on either the icon or the text. Before, with a login button, I was able to do this:

Code: [Select all] [Download] GeSHi © Codebox Plus

web_browser.document.getElementsByClassName("login-register-login-submit")[0].click()


I was able to get the Element because it had a class name. The text I need to click on has the class name of "". I tried this:

Code: [Select all] [Download] GeSHi © Codebox Plus

web_browser.document.querySelectorAll("")


just to try and select all of the elements with the class name "" and I got an error message.

I need some help.
a) how do I copy and paste html code from DOM Explorer
b) how do I click on the drop down menu with ahk? I'd elaborate more but I can't copy and paste the code.
c) do I need to click on the drop down menu to get to the menu item or can I just get to the menu item without doing that
d) how do I click on the menu item with ahk
glen

element selection issue with html dom

21 Jul 2018, 17:22

I don't know how to copy and paste the html code I'm referring to from DOM explorer, so I'll do my best to describe.

The action I'm trying to automate is hovering over some text to open up a drop down menu and to select on a menu item. The menu disappears if you hover away.

I don't know if I need to automate hovering over text or if I can just select the menu item right away. Does the html code restrict me from going directly there without hovering over text?

Anyway, I just want to click on some text in a menu. Here is that:

Code: [Select all] [Download] GeSHi © Codebox Plus

<li class="header-menu-level-list-item">
<a class="" data-action="setAgency" data-id="2010">Some Text Here</a>
</li>


I tried doing this in ahk:

Code: [Select all] [Download] GeSHi © Codebox Plus

web_browser.document.querySelectorAll("")


just to be able to select all of the elements with the class name "". This is the third one. I get an error message when I try that. So maybe I have to open up the drop down menu first.

when I hover over the text to open up the menu, the code in html changes from this:

Code: [Select all] [Download] GeSHi © Codebox Plus

<div class="" data-toggle="categories-menu">


to this

Code: [Select all] [Download] GeSHi © Codebox Plus

<div class="open" data-toggle="categories-menu">


I don't know how to get in there and make it stay open.

Do I need to automate opening the menu first, or can I just through ahk immediately select the menu item? How do I do either?
User avatar
tank
Posts: 2306
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Louisville KY
Contact:

Re: element selection issue with html dom

21 Jul 2018, 19:43

idea but you dont give much info i can use.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
glen

Re: element selection issue with html dom

22 Jul 2018, 11:03

I apologize. I'm new at AHK and this code just went over my head.

What information could I give to better describe the problem? I posted another form question with a more accurate description of the problem.

Return to “Ask For Help”

Who is online

Users browsing this forum: asghar5676, dee1337, IsaacElenbaas, ivyandrei, MIRKOSOFT and 49 guests