Can I set a variable to the result of an xpath?

Hi there! I have a macro I'm trying to create to look up and display a few status messages. The behavior I need is something like:

  1. Go to a link
  2. Set a variable to the text at /html/body/div[5]/table[1]/tbody/tr[1]/td[2]
  3. Click on the link at /html/body/div[5]/table[1]/tbody/tr[1]/td[2]/a
  4. Set variable to to the text at /html/body/div[4]/table/tbody/tr[6]/td[2]
  5. Click on the link with the title "Storage"
  6. Set a variable to the text at /html/body/div[4]/table/tbody/tr[4]/td[3]
  7. Display a window with the text stored within each variable.

Is this possible? I was expecting to find a Google Chrome Control action called "set variable to xpath" or something similar, but I haven't been able to.

"Set Variable to Google Chrome Field" should be the one you are looking for.

https://wiki.keyboardmaestro.com/actions/Browser_Form_Actions?redirect=1

Thanks for this! But so far I've only been able to select text inside of form fields, but not the text in xpath.

Take a look at these Macros and see if they can help you write your macro:

Thanks! This was what I needed.

1 Like