Clicking image with mechanize - ruby

clicking a text agent.click(page.link_with(:text => 'some_text') with mechainze is piece of cake. How to click an image with mechanize?

Clicking on a pure HTML image will typically have no effect. If the image has an onclick handler, you will not be able to click on it with Mechanize as it does not support javascript.
You may want to use something like Capybara with the Webkit, PhantomJS or Selenium driver instead.

It is rather similar. You just need to grab one of the attributes of your image. have a look below..:
agent.click(page.image_with(:alt=> 'your image')

Related

Watir - clicking on element works diffrent than manualy

I wrote test in watir, and one of line doesn't work correctly:
$browser.element(:css => '#sub-15079 > div.ardbnServerInformation').click
When I click manualy on this element, browser opens new tab and everything is fine. But when watir clicks on this element, browser opens new window (instead tab) and data in window doesn't load. How to fix this difference in behaviour?
Sounds like maybe some countermeasures are being used to block the scraping efforts...some kind of javascript thing...
A surefire way to overcome these types of things is to a visual-based automation tool something like Sikuli (sikuli.org) to visually identify a link and click it. It actually uses optical recognition rather than the DOM to identify links and click them.
A more haphazard way to go about this would be to use something like cliclick to click based on screen coordinates, but this is not a very good solution in my opinion.

Is there any other way to visualize the page object in Ruby Mechanize than PrettyPrint?

I wonder if there is any other way to visualize the page object in Ruby Mechanize than PrettyPrint. For example: to render it in a png image file, or show it in a browser window, or print it on the terminal similar to Lynx browser way.

full screen fancybox(iframe)

I use fancybox plugin on my website and I want to display an iframe in fullscreen.
I use this This goes to iframe, and the problem is that the iframe is not displayed full screen.
Check this and click on details to see what I'm talking about.
Why is not working ?
I believe the link is incorrect, here's one that I'm using now and it works.
<p><a class="fancy fancybox.iframe" href="http://www.youtube.com">Link name</a></p>
In your case "fancy" might need to be changed to fancybox fancybox.iframe. Haven't quite figured out the full screen. It looks like it needs to be done using javascript.

jQuery-ui draggable element into CKEditor?

I was testing a different feature, and I somehow, accidentally dropped an image that I had rendered "draggable" with jQuery UI, into a CKEditor (jQuery version) window. The source in the editor was updated accordingly. Serendipity!
But it was like I had just seen a unicorn -- It only happened once, and I was not able to replicate the effect.
Has anyone else been able to get those two tools to work together? If so, what's the trick?
I believe you don't need to make an image "draggable" with jquery to drag it into CkEditor. It works out of the box with any image of the page.

Manipulate Html from Firefox Extension

I am creating a Firefox extension that is somewhat similar to Firebug. There is a panel (or vbox) at the bottom of the browser that allows users to specify colors to certain Html elements. When they click the OK button, I would like these colors to get updated on the current web page.
I have my JavaScript working when I click the button (i am just throwing an alert), however when I change that JavaScript to change the css or styles of an element (by either using document.getElementById or jquery), nothing changes.
Is there something with Firefox extensions that I am missing? Any help is appreciated.
Let me know if you have any questions. Thanks
https://developer.mozilla.org/en/Extension_Frequently_Asked_Questions#Accessing_the_document_of_a_webpage_doesn%27t_work
You want content.document.getElementById() and similarly for every other construct you use.

Resources