I am trying to use KM to tick (check) 2 checkboxes (e.g. ART/General & ART/African) in Google Chrome.
I've failed with both:
-- "Set Chrome Checkbox" [the relevant Checkboxes are not listed in the dropdown "Chrome" menu]
-- "Press a Button"
The simple case is as in the screenshot with the checkboxes onscreen.
but also I'd like to do the following:
The checkboxes are offscreen e.g. in the HISTORY section further down the list of categories. I'd like to check HISTORY/General & HISTORY/African checkboxes.
I'd like to pass both HISTORY and General etc. as Variables to choose the correct checkboxes.
The difficulty may be related to the context of a pop-form, rather than a simple web page.
Is that a publicly accessible resource that we can look at ?
If not, it’s possible that you can get the XPATH to the control by:
Ctrl click it
Choose ‘Inspect’ from the contextual menu
and then in the webkit source view,
Ctrl-click the highlighted source element for the control
Choose Copy As XPATH from the contextual menu
Keyboard Maestro has
excellent built-in actions for clicking on web-page links specified by their labels.
For cases where the target is not uniquely labelled, here is a custom action (generalised from an earlier macro) which should be able to identify and click on any item on a web page.
The item is specified by an XPath, applied either to the whole document, or to the current selection, or mouse position. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Moderator Edit -- 2017-06-26 3:39 PM…
Again, however, it is possible that the popup form context would need some additional special handling - hard to tell without seeing the page itself and the way in which its source code is written.
Thanks for the info. This is for a standard
I tried to follow your instructions (I had to switch temporarily from Chrome to Safari to do the “Inspect Element”). Please see screenshot below.
(I am also not sure how to do the “Copy as XPATH” from here?)
Perhaps the ID: "checkbox-art_general” could be generated from variables and used in KM? Any ideas?
Copy as XPath is Chrome-only.
If you can find
Inspect Element in the Chrome contextual menu, you may need to go through the menu system:
View > Developer
Not a hat from which I can personally pull a rabbit I’m afraid …
Here's the screenshot of the code from CHROME.
-- After Inspecting the element the COPY AS XPATH GIVES: //*[@id="checkbox-art_general"]
-- COPY AS ELEMENT GIVES:input id="checkbox-art_general" type="checkbox" name="" value="" nodeid="art_general"