The issue has to do with attempting to write an Applescript that opens original sized photos while browsing the site vk.com. I have created a similar script for Instagram that I am trying to create here for VK. I press a key combo that triggers Keyboard Maestro to open a higher res version of the photo that I am currently looking at on Instagram. The information on how to get to those larger files on Instagram is somewhat hidden. On VK there is a link to the original sized file, but it is not as easy as just having Javascript click a link.
Here is a link to an example page:
https://vk.com/photo3353595_431330122
And a screen shot of the page, it is the “More” link that I am trying to “click” (FWIW I am able to click the “Share” and “Save to my photos” links using Javascript with no issue.)
And lastly here is a screen shot of Safari’s web inspector, this is the state the page is in when it has been freshly reloaded.
You can see the “More” button that is nested within the .
You can also see that unlike the first two “Share” and “Save…” links there is no ID for “pv_more_actions” just the class name.
Now when you hover over the “More” link you get the following:
There is that link I am looking for!
So this works once the “More” button has been hovered over:
tell application "Safari"
activate
do JavaScript " document.getElementById('pv_more_act_download').click()" in current tab of first window
end tell
Here is what Safari’s Web Inspector shows once the link has been hovered over:
So now there are additional Elements after “More”.
So what I am trying to do is to automate the loading of those elements so that the “pv_more_act_download” element is exposed which I can then use javascript to click on.
So far I have tried all of these javascript commands to try and get the elements for the “More” button to load with no luck.
do JavaScript " document.getElementById('pv_more_acts_tt').click()" in current tab of first window
do JavaScript " document.getElementByClassName('pv_more_actions' 'pv_more_shown').click()" in current tab of first window
do JavaScript " document.getElementByClassName(''pv_more_shown'').click()" in current tab of first window
do JavaScript " document.getElementByClassName('pv_more_actions').click()" in current tab of first window
do JavaScript " document.getElementByClassName('pv_more_actions').mouseenter()" in current tab of first window
do JavaScript " document.getElementByClassName('pv_more_actions').mouseleave()" in current tab of first window
do JavaScript " document.getElementByClassName('pv_more_actions').mouseenter()" in current tab of first window
do JavaScript " document.getElementByClassName('pv_more_actions').mouseleave()" in current tab of first window
I have also tried .hover() with no success.
I have searched high and low looking for a solution to hover over that more button to get those elements to load. I have even thought of cliclick, but give the button is on the bottom right hand corner of each window it is hard to predict where the button might be for any given photo.
So please someone tell me I am just dumb and the answer is staring me in the face!