【问题标题】:How to write URL in browser address bar in AutoIt如何在 AutoIt 的浏览器地址栏中写入 URL
【发布时间】:2015-01-11 16:16:25
【问题描述】:

我可以使用

打开浏览器
Run("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")

在 AutoIt 中。但无法获得任何功能在地址栏中写入 URL 说“google.com”。

  • 有人可以帮我吗?

【问题讨论】:

    标签: autoit


    【解决方案1】:

    使用地址栏导航到您想要的任何页面。浏览器使用 Alt-d 激活选择当前地址的地址栏。因此,输入新地址将替换旧地址。

    Send ( "!dhttp://google.com{ENTER}" )
    

    !d 是 Alt-d 的 AutoIt 语法

    如果您的浏览器没有自动选择所有文本,您可以添加 Ctrl-A 自行选择所有文本。

    Send ( "!d^ahttp://google.com{ENTER}" )
    

    【讨论】:

      【解决方案2】:

      使用 google.com 打开默认浏览器:

      ShellExecute("http://www.google.com")
      

      【讨论】:

        【解决方案3】:

        您可以在此处https://github.com/AOT-DEP-PADI/ChromeLauncher 找到一些信息以在页面上启动 chrome。

        使用 Autoit,只需添加参数

        Local $chrome_url_start = "http:\\www.google.fr"
        Local $chrome_arguments = " --new-window --incognito"
        
        Local $ProgramFilesDir = EnvGet('ProgramFiles(x86)') ; for 64bit Win it will return a valid path.
        If not $ProgramFilesDir Then $ProgramFilesDir = @ProgramFilesDir ; for 32bit Win this will "repair" the broken return from above.
        Run($ProgramFilesDir & "\Google\Chrome\Application\chrome.exe "&$chrome_url_start&$chrome_arguments)
        

        【讨论】:

        • 不要忘记变量 $chrome_arguments (" --new-window") 中的空格
        【解决方案4】:

        如果您有兴趣在 IE 中运行网站:

        #include <IE.au3>
        $oIE = _IECreate("http://www.google.com")
        

        要导航到另一个页面,请使用

        _IENavigate($oIE, "http://www.autoitscript.com/forum/index.php?")
        

        查看帮助文件了解很多 IE 自动化功能。

        【讨论】:

          猜你喜欢
          • 2011-04-20
          • 1970-01-01
          • 2011-05-05
          • 1970-01-01
          • 2013-07-04
          • 2015-02-09
          • 2014-01-28
          • 2010-12-24
          相关资源
          最近更新 更多