查找 Internet Explorer 浏览器
查找 Microsoft Internet Explorer 浏览器实例。
命令可用性: 本地 IBM RPA SaaS 和 IBM RPA
描述
查找尚未由 IBM RPA Studio 启动或嵌入到另一个应用程序中的 Microsoft Internet Explorer 浏览器实例。
脚本语法
IBM RPA 的专有脚本语言具有类似于其他编程语言的语法。 该脚本语法在脚本文件中定义命令的语法。 您可以在 IBM RPA Studio的 脚本 方式下使用此语法。
findBrowser [--forcerefresh(Boolean)] --selector(ControlSelectors) --id(String) --name(String) --innertext(String) --tagname(String) --xpath(String) --classname(String) --elementvalue(String) --controltype(Nullable<ControlTypes>) --index(Numeric) --control(Control) [--timeout(TimeSpan)] (Boolean)=success (Browser)=value (String)=name
依赖关系
- Microsoft Internet Explorer 并非由启动浏览器 (
webStart) 命令启动。
输入参数
下表显示了此命令中提供的输入参数的列表。 在表中,您可以看到在 IBM RPA Studio的脚本方式及其 Designer 方式等效标签中工作时的参数名称。
| 设计器方式标签 | 脚本方式名称 | 必需的 | 接受的变量类型 | 描述 |
|---|---|---|---|---|
| 更新屏幕高速缓存 | forcerefresh |
Optional |
Boolean |
启用以在运行命令之前再次读取屏幕,并使用它来识别新元素并更新屏幕高速缓存。 如果屏幕上有任何更改,那么必需此标识,该命令才能正常工作。 |
| 选择器 | selector |
Required |
ControlSelectors |
用于标识浏览器中接口控件的选择器类型。 请参阅选择器参数选项。 |
| 标识 | id |
Required when the Selector parameter is Id, IdAndName |
Text |
浏览器实例的控件标识。 |
| 名称 | name |
Required when the Selector parameter is Name, NameAndValue, IdAndName, TypeAndName |
Text |
浏览器实例的接口的名称。 |
| 内部文本 | innertext |
Required when the Selector parameter is InnerTextAndTag |
Text |
浏览器中接口控件元素的内部文本。 |
| 元素类型 | tagname |
Required when the Selector parameter is InnerTextAndTag |
Text |
浏览器中接口控件元素的类型。 |
| XPath | xpath |
Required when the Selector parameter is XPath |
Text |
浏览器中接口控件的 XML 路径。 |
| 类 | classname |
Required when the Selector parameter is ClassAndValue, ClassName |
Text |
浏览器中接口控件的类名。 |
| 元素值 | elementvalue |
Required when the Selector parameter is ClassAndValue, NameAndValue |
Text |
浏览器中接口控件的当前值。 |
| 类型 | controltype |
Required when Selector parameter is , TypeAndName |
ControlTypes |
浏览器中控件应用程序的类型。 |
| 索引 | index |
Required when Selector parameter is TypeAndIndexCurrent |
Number |
浏览器中的接口控件的索引。 |
| 控制 | control |
Required when Selector parameter is Instance |
Control |
使用搜索控件 (searchControl) 命令获取的控件实例。 |
| Timeout | timeout |
Optional |
Text, Time Span, Number |
运行命令时的最长等待时间。 如果为空白,那么缺省超时为 5 秒。 |
selector 参数选项
下表显示了可用于 selector 输入参数的选项。 该表显示了在脚本方式下工作时的可用选项以及在设计器方式下的等效标签。
| 设计器方式标签 | 脚本方式名称 | 描述 |
|---|---|---|
| 标识 | Id |
根据"标识"属性值与元素匹配。 |
| 名称 | Name |
根据"名称"属性值与元素匹配。 |
| 链接文本 | LinkText |
根据链接文本属性值与元素匹配。 |
| 内部文本和控件类型 | InnerTextAndTag |
根据元素文本内容和标记名称属性值与元素匹配。 |
| XPath | XPath |
根据 HTML 根中的 XML 路径与元素匹配。 |
| 类和值 | ClassAndValue |
根据类名和值属性与元素匹配。 |
| 名称和值 | NameAndValue |
根据名称和值属性与元素匹配。 |
| 标识和名称 | IdAndName |
根据标识和名称属性值与元素匹配。 |
| 类名 | ClassName |
浏览器中接口控件的类名。 |
| 类型和索引 | TypeAndIndex |
浏览器界面的控件和索引的类型。 |
| 类型和名称 | TypeAndName |
属于浏览器的控件和名称的类型。 |
| 实例 | Instance |
控件实例 |
输出参数
| 设计器方式标签 | 脚本方式名称 | 接受的变量类型 | 描述 |
|---|---|---|---|
| 成功 | success |
Boolean |
如果找到窗口,那么将返回 true;否则将返回 false。 |
| 浏览器 | value |
Browser |
返回 Internet Explorer 浏览器实例。 请使用 Browser 变量来处理浏览器。 |
| 名称 | name |
Text |
返回为浏览器给定的名称。 |
示例
将使用 查找窗口 (findWindow) 命令中的 "类" 选择器和 查找 Internet Explorer 浏览器 (findBrowser) 命令中的 "XPath" 选择器来搜索 Internet Explorer 浏览器,以将此浏览器附加到 IBM RPA Studio 并浏览至 IBM Web 页面。
defVar --name window --type Window
defVar --name processId --type Numeric
defVar --name foundWindow --type Boolean
defVar --name foundBrowser --type Boolean
defVar --name browser --type Browser
defVar --name browserName --type String
openFile --file "iexplore.exe"
// Search and associate the Internet Explorer window using the "IEFrame" class.
delay --timeout "00:00:03"
findWindow --classname IEFrame --safesearch window=value processId=processId foundWindow=success
attachWindow --window ${window}
// Find the Internet Explorer browser instance, and navigate to the Google web page.
findBrowser --selector "XPath" --xpath "/root" --timeout "00:00:10" foundBrowser=success browser=value browserName=name
webNavigate --url "https://www.ibm.com/"
logMessage --message "Success in finding the browser: ${foundBrowser}\r\nFound browser name: ${browserName}" --type "Info"
webClose --name "${browserName}" --leavebrowseropen