Search code examples
imacros

Cannot figure out how to press enter


I need put number of page into input field and click enter, to make search. I tried recording with EVENT mode but it doesn't record when pressing any key.

Here is my code to enter page number

EVENT TYPE=CLICK SELECTOR="#searchResults>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)" BUTTON=0
EVENT TYPE=KEYPRESS SELECTOR="#searchResults>DIV>DIV>DIV>DIV:nth-of-type(2)>INPUT" CHAR="9"
EVENT TYPE=KEYPRESS SELECTOR="#searchResults>DIV>DIV>DIV>DIV:nth-of-type(2)>INPUT" KEY=13

Code doesn't return any errors, but enter key not pressed I have tried also like this:

EVENT TYPE=KEYPRESS SELECTOR="div[class='page']" KEY=13

The structure of HTML:

enter image description here


Solution

  • Try these commands:

    EVENT TYPE=KEYDOWN SELECTOR="#searchResults>DIV>DIV>DIV>DIV:nth-of-type(2)>INPUT" KEY=13
    

    or

    EVENT TYPE=KEYUP SELECTOR="#searchResults>DIV>DIV>DIV>DIV:nth-of-type(2)>INPUT" KEY=13