2

Possible Duplicate:
Is there a way to simulate key presses or a click with javascript?

I know it's an old and repeated question, but before replying "google it", read the question plz .

I'm trying to simulate some of user interactions with page in my chrome extension and one of them is mouse click. I can "click" on links with a proper href and move to that page (window.location etc ) but my problem is with anchors that load content via ajax, for example in facebook home page, if I want to trigger the "Top News" news feed button, in theory I should use : $(".uiHeaderActions .fwn").click(); but it doesnt do anything ... and idea ?

Community
  • 1
  • 1
Sina Fathieh
  • 1,727
  • 1
  • 20
  • 35

2 Answers2

2

Maybe they hook in to a different event than click?

Check out this duplicate ticket: Is there a way to simulate key presses or a click with javascript?

Community
  • 1
  • 1
Dawson Toth
  • 5,580
  • 2
  • 22
  • 37
  • I'm gonna try it with facebook one, but I had the same problem with google n other sites as well, I'll see if that function works – Sina Fathieh Jan 31 '11 at 05:52
  • I'm going to try it too. Just wondering... are you writing a test automation extension or something? That'd be pretty cool. – Dawson Toth Jan 31 '11 at 06:00
  • it sorta works, I just need to modify my extension a little bit, but worked on google, so thanks ! the extension is something cool, you can record your interactions on page and later pass it to someone else to for example show them how to do something on a site, for example if u wanna teach ur friend how to use facebook chat ... and its gonna be open source ;) version beta will be out soon :) – Sina Fathieh Jan 31 '11 at 06:32
  • 1
    @hakim-sina if you haven't seen Selenium, check it out. It sounds like what you are describing (for firefox). – pkaeding Jan 31 '11 at 07:07
-1

Can you be more specific ? This is how I think

$().ready(function(){
    $('.uiHeaderActions fwn').click(function(){
       $(this).load('something.com');

}); });

Good luck

dbwebtek
  • 245
  • 3
  • 5
  • Oo .... errm, I just want to simulate physical mouse click on an element ... and yes, I have tried .click as I said in my question, but it doesnt work ... – Sina Fathieh Jan 31 '11 at 06:21