Loading ...
Sorry, an error occurred while loading the content.

How to click on a button

Expand Messages
  • mkjain15
    Hi All, I have a query as following: 1: Want to invoke Interner explorer 2: Then navigate to www.google.com 3: Enter any text say perl in search text area,
    Message 1 of 4 , Aug 20, 2006
    • 0 Attachment
      Hi All,

      I have a query as following:

      1: Want to invoke Interner explorer
      2: Then navigate to www.google.com
      3: Enter any text say "perl" in search text area,
      4: Click on google search button;

      I am able to invoke the IE and able to navigate to www.google.com
      page.
      But not able enter a text and click on "Google Search" Button.

      use Win32::OLE;
      use Win32::GuiTest qw(:ALL);
      my $URL = "www.google.com";
      my $IE = Win32::OLE->new("InternetExplorer.Application")
      || die "Could not start Internet Explorer.Application\n";

      $IE->{visible} = 1;

      $IE->Navigate($URL);

      sleep 5;
      PushButton "^Google Search"

      Please advise me any solution.

      Thanks in advance,

      Cheers!!!
      Manish
      "HELP EVER, HURT NEVER"
    • Martin McGrath
      First of all what are do you intend to do with the search results? You may want to check out the Google terms of service
      Message 2 of 4 , Aug 20, 2006
      • 0 Attachment
        First of all what are do you intend to do with the search results? You may want to check out the Google terms of service (http://www.google.co.uk/intl/en/terms_of_service.html)

        " Personal Use Only

        The Google Services are made available for your personal, non-commercial use only. You may not use the Google Services to sell a product or service, or to increase traffic to your Web site for commercial reasons, such as advertising sales. You may not take the results from a Google search and reformat and display them, or mirror the Google home page or results pages on your Web site. You may not "meta-search" Google. If you want to make commercial use of the Google Services, you must enter into an agreement with Google to do so in advance."

        Please do not break the terms of service.

        Secondly is therea reason you are not using the Mechanize module? Either WWW::Mechanize or Win32::IE::Mechanize (the latter if you actually wish to drive IE).

        mkjain15 <mkjain76@...> wrote: Hi All,

        I have a query as following:

        1: Want to invoke Interner explorer
        2: Then navigate to www.google.com
        3: Enter any text say "perl" in search text area,
        4: Click on google search button;

        I am able to invoke the IE and able to navigate to www.google.com
        page.
        But not able enter a text and click on "Google Search" Button.

        use Win32::OLE;
        use Win32::GuiTest qw(:ALL);
        my $URL = "www.google.com";
        my $IE = Win32::OLE->new("InternetExplorer.Application")
        || die "Could not start Internet Explorer.Application\n";

        $IE->{visible} = 1;

        $IE->Navigate($URL);

        sleep 5;
        PushButton "^Google Search"

        Please advise me any solution.

        Thanks in advance,

        Cheers!!!
        Manish
        "HELP EVER, HURT NEVER"






        ---------------------------------
        Try the all-new Yahoo! Mail . "The New Version is radically easier to use" – The Wall Street Journal

        [Non-text portions of this message have been removed]
      • Lee Marlin
        Here are two solutions that DO work one is via Win32::GuiTest; the other is with Win32::IEAutomation after you start IE and enter http://www.google.com, do a
        Message 3 of 4 , Aug 20, 2006
        • 0 Attachment
          Here are two solutions that DO work


          one is via Win32::GuiTest; the other is with Win32::IEAutomation

          after you start IE and enter http://www.google.com,
          do a View -> Source
          it's actually javascript so that "button" is not what it seems

          =========================
          use Win32::OLE;
          use Win32::GuiTest qw(:ALL :SW);
          my $URL = "http://www.google.com";
          my $IE = Win32::OLE->new("InternetExplorer.Application")
          || die "Could not start Internet Explorer.Application\n";
          $IE->{visible} = 1;
          $IE->Navigate($URL);

          sleep 5;
          SendKeys("Perl");
          SendKeys ("{TAB}");
          sleep 1;
          SendKeys("{ENTER}");

          # PushButton ("Google Search");

          ===============================================================
          2nd alternative
          ===============================================================
          use Win32;
          # These modules are available from CPAN
          use Win32::IEAutomation;
          use Win32::IEAutomation::WinClicker; # this will provide methods to interact with dialog box

          my $ie = Win32::IEAutomation->new( );
          $ie->gotoURL('http://www.google.com');
          my $clicker = Win32::IEAutomation::WinClicker->new();
          $ie->{visible} = 1;
          $variable ="Perl";
          $ie->getTextBox('name:', "q")->SetValue($variable);
          $ie->getButton('caption:',"Google Search")->Click();

          Lee Marlin

          mkjain15 <mkjain76@...> wrote:
          Hi All,

          I have a query as following:

          1: Want to invoke Interner explorer
          2: Then navigate to www.google.com
          3: Enter any text say "perl" in search text area,
          4: Click on google search button;

          I am able to invoke the IE and able to navigate to www.google.com
          page.
          But not able enter a text and click on "Google Search" Button.

          use Win32::OLE;
          use Win32::GuiTest qw(:ALL);
          my $URL = "www.google.com";
          my $IE = Win32::OLE->new("InternetExplorer.Application")
          || die "Could not start Internet Explorer.Application\n";

          $IE->{visible} = 1;

          $IE->Navigate($URL);

          sleep 5;
          PushButton "^Google Search"

          Please advise me any solution.

          Thanks in advance,

          Cheers!!!
          Manish
          "HELP EVER, HURT NEVER"






          ---------------------------------
          Do you Yahoo!?
          Everyone is raving about the all-new Yahoo! Mail Beta.

          [Non-text portions of this message have been removed]
        • mkjain15
          Thank you Lee !!! Cheers!!! Manish HELP EVER,HURT NEVER ... to interact with dialog box
          Message 4 of 4 , Aug 21, 2006
          • 0 Attachment
            Thank you Lee !!!

            Cheers!!!
            Manish
            "HELP EVER,HURT NEVER"


            --- In perlguitest@yahoogroups.com, Lee Marlin <lmarlin@...> wrote:
            >
            > Here are two solutions that DO work
            >
            >
            > one is via Win32::GuiTest; the other is with Win32::IEAutomation
            >
            > after you start IE and enter http://www.google.com,
            > do a View -> Source
            > it's actually javascript so that "button" is not what it seems
            >
            > =========================
            > use Win32::OLE;
            > use Win32::GuiTest qw(:ALL :SW);
            > my $URL = "http://www.google.com";
            > my $IE = Win32::OLE->new("InternetExplorer.Application")
            > || die "Could not start Internet Explorer.Application\n";
            > $IE->{visible} = 1;
            > $IE->Navigate($URL);
            >
            > sleep 5;
            > SendKeys("Perl");
            > SendKeys ("{TAB}");
            > sleep 1;
            > SendKeys("{ENTER}");
            >
            > # PushButton ("Google Search");
            >
            > ===============================================================
            > 2nd alternative
            > ===============================================================
            > use Win32;
            > # These modules are available from CPAN
            > use Win32::IEAutomation;
            > use Win32::IEAutomation::WinClicker; # this will provide methods
            to interact with dialog box
            >
            > my $ie = Win32::IEAutomation->new( );
            > $ie->gotoURL('http://www.google.com');
            > my $clicker = Win32::IEAutomation::WinClicker->new();
            > $ie->{visible} = 1;
            > $variable ="Perl";
            > $ie->getTextBox('name:', "q")->SetValue($variable);
            > $ie->getButton('caption:',"Google Search")->Click();
            >
            > Lee Marlin
            >
            > mkjain15 <mkjain76@...> wrote:
            > Hi All,
            >
            > I have a query as following:
            >
            > 1: Want to invoke Interner explorer
            > 2: Then navigate to www.google.com
            > 3: Enter any text say "perl" in search text area,
            > 4: Click on google search button;
            >
            > I am able to invoke the IE and able to navigate to www.google.com
            > page.
            > But not able enter a text and click on "Google Search" Button.
            >
            > use Win32::OLE;
            > use Win32::GuiTest qw(:ALL);
            > my $URL = "www.google.com";
            > my $IE = Win32::OLE->new("InternetExplorer.Application")
            > || die "Could not start Internet Explorer.Application\n";
            >
            > $IE->{visible} = 1;
            >
            > $IE->Navigate($URL);
            >
            > sleep 5;
            > PushButton "^Google Search"
            >
            > Please advise me any solution.
            >
            > Thanks in advance,
            >
            > Cheers!!!
            > Manish
            > "HELP EVER, HURT NEVER"
            >
            >
            >
            >
            >
            >
            > ---------------------------------
            > Do you Yahoo!?
            > Everyone is raving about the all-new Yahoo! Mail Beta.
            >
            > [Non-text portions of this message have been removed]
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.