How can I find a specific JavaScript identifier of a website? I want to use JavaScript to set the scroll amount of a webpage in an AppleScript, using the second method described in this answer.

This answer focuses on one webpage in particular. I want to branch this method out, so that I can use it on any other webpage. I am unfamiliar with JavaScript.

So, is there some way that I can hover my mouse in a certain location of a webpage, and then I am told what the corresponding JavaScript identifier is? If that's not possible, is there a way to get the JavaScript identifier name of a specific visual element on a webpage?
As an example in Google Chrome, using the URL of this question and setting the scroll to point to the question header of the page, use Chrome > View > Developer > Developer Tools ⌥⌘I to find the id. In this case it's called question-header.

You can also right-click and select Inspect from the context menu, which will bring up Developer Tools directly to that point in the code.

The following code will open this page and scroll to the question header.

set myURL to "http://apple.stackexchange.com/questions/276314/how-can-i-find-a-specific-javascript-identifier-of-a-website#276314"
tell application "Google Chrome"
    activate
    tell front window to set curTab to make new tab at after (get active tab) with properties {URL:myURL}
    tell curTab
        repeat while (loading)
            delay 1
        end repeat
        -- scroll to the top of the question header.
        execute javascript "e=document.getElementById('question-header');tTop=0; do {tTop +=e.offsetTop || 0; e=e.offsetParent} while(e); window.scrollTo(0,tTop);"
    end tell
end tell


You can see in the code above that question-header was swapped for twc-scrollabe in the execute javascript ... line of code.



You can also get a quick list of the &lt;div id= anchor points using curl in Terminal and piping the output to grep, as in the example for this page.

$ curl -s 'http://apple.stackexchange.com/questions/276314/how-can-i-find-a-specific-javascript-identifier-of-a-website' | grep '&lt;div id='
    &lt;div id="notify-container"&gt;&lt;/div&gt;
    &lt;div id="custom-header"&gt;&lt;/div&gt;
            &lt;div id="header"&gt;
                &lt;div id="hlogo"&gt;
                &lt;div id="hmenus"&gt;
        &lt;div id="content"&gt;
&lt;div id="herobox"&gt;
    &lt;div id="hero-content"&gt;
            &lt;div id="close"&gt;&lt;a title="click to minimize"&gt;_&lt;/a&gt;&lt;/div&gt;
        &lt;div id="blurb"&gt;
        &lt;div id="desc"&gt;
&lt;/script&gt;           &lt;div id="question-header"&gt;
            &lt;div id="mainbar"&gt;
        &lt;div id="comments-276314" class="comments  dno"&gt;
        &lt;div id="comments-link-276314" data-rep=50 data-anon=true&gt;
            &lt;div id="answers"&gt;
                &lt;div id="answers-header"&gt;
                            &lt;div id="tabs"&gt;
&lt;div id="answer-276316" class="answer" data-answerid="276316"  itemscope itemtype="http://schema.org/Answer"&gt;
        &lt;div id="comments-276316" class="comments  dno"&gt;
        &lt;div id="comments-link-276316" data-rep=50 data-anon=true&gt;
&lt;div id="post-editor" class="post-editor js-post-editor"&gt;
            &lt;div id="wmd-button-bar" class="wmd-button-bar"&gt;&lt;/div&gt;
    &lt;div id="draft-saved" class="draft-saved community-option fl" style="margin-top: 8px; height:24px; display:none;"&gt;draft saved&lt;/div&gt;
    &lt;div id="draft-discarded" class="draft-discarded community-option fl" style="margin-top: 8px; height:24px; display:none;"&gt;draft discarded&lt;/div&gt;
    &lt;div id="wmd-preview" class="wmd-preview"&gt;&lt;/div&gt;
                &lt;div id="sidebar" class="show-votes"&gt;
&lt;div id="hot-network-questions" class="module tex2jax_ignore"&gt;
&lt;div id="feed-link"&gt;
    &lt;div id="feed-link-text"&gt;
    &lt;div id="footer" class="categories"&gt;
            &lt;div id="footer-menu"&gt;
                &lt;div id="footer-sites"&gt;
            &lt;div id="copyright"&gt;
            &lt;div id="svnrev"&gt;
                &lt;div id="additional-notices"&gt;
        &lt;div id="noscript-warning"&gt;Ask Different works best with JavaScript enabled&lt;img src="https://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif" alt="" class="dno"&gt;&lt;/div&gt;
$


Note: While curl will bring the page down, the grep command as shown in the example may not work as nice as it did for this page. Some page content doesn't have line breaks and the code is a contiguous stream.