在Browser Automation Studio中,如何创建一个机器人,该机器人使用Javascript从Excel文件中复制文本并将其粘贴到网站上的字段中?

In Browser Automation Studio how to create a bot that copies text from an Excel file and pastes it into a field on a website using Javascript?

提问人:Mohamed FALL 提问时间:9/13/2023 最后编辑:Mohamed FALL 更新时间:10/2/2023 访问量:150

问:

我使用Browser Automation Studio版本26.1.1来自动执行我的任务。

我已经创建了一个项目,添加了操作,一切正常。我添加了“读取单元格”操作,使机器人复制 Excel 文件单元格 C3 的第 4 页中的一些文本,并将其粘贴到网站的字段中。我单击了机器人应粘贴文本的字段。我单击了“在 Element 上运行 Javascript”操作并添加了以下代码:

// Select the field where you want to paste the text
var element = document.querySelector(">CSS> :nth-child(2) > :nth-child(1) > :nth-child(2) > input");

// Paste the text into the field
element.value = Engine.GetClipboardText("VARTRTITLEPAGE");

我希望机器人从我的 Excel 文件中复制文本并将其粘贴到我网站上的字段中。如果我运行该脚本,Browser Automation Studio控制台将显示以下信息:

[989688634] [13:19:54] 主题 #1:SyntaxError:无法对“文档”执行“querySelector”:“>CSS> :nth -child(2) > :nth-child(1) > :nth -child(2) >输入”不是有效的选择器。

你可以帮我吗?

自动化 复制 机器人任务 粘贴

评论


答: 暂无答案