【问题标题】:How to add an attachment in Gmail using selenium RC/Webdriver如何使用 selenium RC/Webdriver 在 Gmail 中添加附件
【发布时间】:2014-05-14 18:47:53
【问题描述】:

谁能告诉我如何使用 selenium RC/Webdriver 在 Gmail/Yahoo 邮件中添加附件。

请在这种情况下帮助我。

提前致谢。

【问题讨论】:

  • 您可以使用 AutoIT 工具来处理窗口 gui 并附加文件。访问 www.autoitscript.com

标签: selenium gmail selenium-rc selenium-webdriver yahoo


【解决方案1】:

在您的机器上安装 Autoit。 编写如下所示的 AutoIT 脚本。

  WinWaitActive("Choose file")  \\specify the name of the choose window
  Send("C:\attach\samplefile.txt") \\location of the file you want to attach 
  Send("{ENTER}") 

编写代码后,将文件另存为attach.exe 将以下行添加到您的 selenium 代码中(如果使用 java)

  Runtime.getRuntime().exec("c:\\path\\attach.exe");  

以上内容将有助于添加附件。希望对您有所帮助!

【讨论】:

  • 下载了 autoit 工具,但是当我试图运行脚本时,我收到了一个警报。在堆栈溢出中,我不知道如何附加图像。请在以下链接中找到图片:edutechquestions.blogspot.in/2013/02/…
  • 从这里下载 autoit 文件 findthatzipfile.com/download.php?i=12632497&t=hZIP 编写 autoit 脚本。将文件另存为 attach.au3 然后使用下载的 zip 文件 Aut2Exe.exe (73 kb) 中的以下实用程序将 attach.au3 文件转换为 attach.exe 文件 转换后,将 exe 文件的路径放在代码中。如果您仍然遇到任何问题,请告诉我。在此过程中,无需安装 AutoIT 软件。您只需解压缩文件并使用实用程序即可。
【解决方案2】:

我使用机器人 api 找到了这个问题的答案。感谢回答这个问题的人。

【讨论】:

    猜你喜欢
    • 2015-03-17
    • 1970-01-01
    • 1970-01-01
    • 2020-03-02
    • 2012-11-13
    • 2022-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多