1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Imacros unable to click

Discussion in 'Tumblr' started by user44444, Jul 11, 2016.

  1. user44444

    user44444 Newbie

    Joined:
    Jul 11, 2016
    Messages:
    9
    Likes Received:
    0
    On tumblr in chrome version 51, if Imacros opens up the white silhouette dropdown menu in the top right, and then selects the yourblognamehere button, nothing happens. However, if I manually open the dropdown menu for Imacros, it can click the button just fine. Here's the code imacros generated based on what I clicked in record mode:

    VERSION BUILD=844 RECORDER=CR
    TAG SELECTOR="HTML>BODY>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV:nth-of-type(6)>BUTTON>I"
    TAG SELECTOR="HTML>BODY>DIV:nth-of-type(12)>DIV>DIV>UL>LI:nth-of-type(2)>UL>LI>UL>LI>DIV>A>SPAN:nth-of-type(2)>SPAN"


    I combed through the Imacros documentation for several hours, but I'm really not good with this stuff.
     
  2. jtrash01

    jtrash01 Regular Member

    Joined:
    Nov 5, 2013
    Messages:
    270
    Likes Received:
    117
    Location:
    BARCELONA, SPAIN
    Your css selectors sucks... at least you know the existence of pseudo selectors. The way you did it leads to errors sooner or later. YOUR MAIN ERROR IS TO WRITE LOOOONG CSS SELECTOR. Css selectors MUST be concise.
    For sure you could have been used a class name, or other attribute to avoid that long selectors... to use attributes with CSS selectors you can do element[attribute="value"] another example: button[name="login_button"] you can also directly use classes or ID's as selectors .myclassname or #myidname and keep in mind that CSS has operators for attribute selectors, so you can select an element that contains a class, not only an exact full match:
    Code:
    [attribute=value]    [target=_blank]    Selects all elements with target="_blank"    2
    [attribute~=value]    [title~=flower]    Selects all elements with a title attribute containing the word "flower"    2
    [attribute|=value]    [lang|=en]    Selects all elements with a lang attribute value starting with "en"    2
    [attribute^=value]    a[href^="https"]    Selects every <a> element whose href attribute value begins with "https"    3
    [attribute$=value]    a[href$=".pdf"]    Selects every <a> element whose href attribute value ends with ".pdf"    3
    [attribute*=value]    a[href*="w3schools"]    Selects every <a> element whose href attribute value contains the substring "w3schools"
    Source: http://www.w3schools.com/cssref/css_selectors.asp

    An example of a complex selector: div[class~='like']:not([class~='liked']) It says: Select a div or divs that in the class attribute contains the word "like" but not contains the word "liked" (this is a Tumblr real example, from my liker)

    My advice is to learn python, selenium (and what XPATH is), lxml, http protocol (and to use mitmproxy, or anyother http client), javascript. And you'll see then that iMacros truly sucks.

    Ps: you should also keep in mind that some elements are behind others... and thats why iMacros can't at first hit buttons...(witthout tweaking code (visibility, position, z-index and so)) And sometimes content is generated afterwards with javascript...
     
    Last edited: Jul 11, 2016
  3. user44444

    user44444 Newbie

    Joined:
    Jul 11, 2016
    Messages:
    9
    Likes Received:
    0
    Hey jtrash01, thanks for the response. I don't know what half that stuff you mentioned is, or how it should be typed when put into imacros. Also, I didn't write the code above, imacros generated it for me haha.

    I'll look at the site you linked and search the imacros site for the keyterms you mentioned, though. Thanks!
     
  4. jtrash01

    jtrash01 Regular Member

    Joined:
    Nov 5, 2013
    Messages:
    270
    Likes Received:
    117
    Location:
    BARCELONA, SPAIN
    What was you trying to do ?
     
  5. user44444

    user44444 Newbie

    Joined:
    Jul 11, 2016
    Messages:
    9
    Likes Received:
    0
    I'm using imacros to navigate the top-right dropdown menu>myblognamehere, and then I want it to copy the url into a google spreadsheet. I'm just having issues with clicking myblognamehere, that's it.

    Edit: if the dropdown menu is opened by me, imacros can click it. If not, imacros says it couldn't find the element.
     
  6. jtrash01

    jtrash01 Regular Member

    Joined:
    Nov 5, 2013
    Messages:
    270
    Likes Received:
    117
    Location:
    BARCELONA, SPAIN
    For selecting your blogname you could try if using this selector works: input[name="t"] since there's this code in the dashboard <input type="hidden" name="t" value="BLOGNAME"> and take its value attribute value... or maybe you could use .blog_name_span from <a class="blog_name" href="/blog/BLOGNAME"><span class="blog_name_span">BLOGNAME</span></a> and again take its value...

    Without trying it... maybe:
    TAG POS=1 TYPE=SPAN ATTR=CLASS:blog_name_span EXTRACT=TXT

    You'll be doing yourself a favor if u learn python / selenium (selenium api is easier than iMacros api and works far better):

    When installing python make sure you check the option to include python in your PATH:
    After install, go to a command prompt (WIN + R and type cmd.exe in windows, or open a powershell console) and type "python" without quotes... If the interpreter runs Installation was ok.

    pip is the package manager of python, you need it to install packages. From the same command prompt type "pip install selenium" and selenium will get installed... Then you can create a with a ".py" extension to create a python script...

    Knowing that you should carefully read and follow: http://selenium-python.readthedocs.io/installation.html
    And create an python_org_search.py file with the contents of the first example in here: http://selenium-python.readthedocs.io/getting-started.html
    and then try to execute it from that command prompt you opened before (you must cd to the same folder the file is in): python python_org_search.py

    For this to work you MUST have firefox installed
     
    Last edited: Jul 11, 2016
  7. user44444

    user44444 Newbie

    Joined:
    Jul 11, 2016
    Messages:
    9
    Likes Received:
    0
    Thanks for all your help man! I'm gonna go to bed and look at this stuff in the morning.