in reply to Re^2: Executing JavaScript function using WWW::Mechanize::Firefox
in thread Executing JavaScript function using WWW::Mechanize::Firefox

Thanks, but that yields the error "MozRepl::RemoteObject: TypeError: 'alert' called on an object that does not implement interface Window. at test_js.pl line 23."

That is an important message and clue about the environment you're facing

Also, my problem is that in my use case, I don't write the JavaScript myself -- I am trying to have Firefox use a website that has a couple of functions which I want to call.

Can you get firefox to do that without involving perl ?

Because browsers kind of go out of their way to forbid such tricks because of security issues

  • Comment on Re^3: Executing JavaScript function using WWW::Mechanize::Firefox

Replies are listed 'Best First'.
Re^4: Executing JavaScript function using WWW::Mechanize::Firefox
by Anonymous Monk on Feb 17, 2016 at 02:44 UTC

    Not sure I understand what kind of a clue this is. Can you elaborate?

    Manual operation of the website works just fine! And since ReplMoz is inside the browser, I should not be caught by the browser doing anything fishy, right?

    Here is what the actual link in the website I am facing looks like:

    <a href='#' onclick='goToPage(2);return false;'>Next &gt;</a>

    And yes, I know, I can click that link in a different way, but the thing is that I want to be able to tell it to which page it should go, i.e. I want to call goToPage with a parameter of my choosing.

        Actually I had been to that website before, but the thing is that I don't understand. It says "This allows access to variables and functions declared "globally" on the web page." I understand that somehow I am not in the right "context". But if I understand you correctly, then you are saying there is no way to get there?