1

我正在Kantu Browser Automation使用Chrome.

想象一下,我有以下随机网站:

https://www.100lenders.com/index.php

然后我想检查My Loan Amount右上方区域对应的select元素是否有49个选项?

在此处查看右上角的面板预览。

为此,我有以下内容JSON

{
  "CreationDate": "2018-10-22",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://www.100lenders.com/index.php",
      "Value": ""
    },
    {
      "Command": "select",
      "Target": "id=loanSelect",
      "Value": "label=$700"
    },
    {
      "Command": "storeEval",
      "Target": "document.querySelectorAll('#loanSelect option').length",
      "Value": "count"
    },
    {
      "Command": "echo",
      "Target": "${count}",
      "Value": ""
    }
  ]
}

实际输出:49正如您在下面的日志中看到的:

[status]
Playing macro 100lenders.com
[info]
Executing:  | open | https://www.100lenders.com/index.php |  | 
[info]
Executing:  | select | id=loanSelect | label=$700 | 
[info]
Executing:  | storeEval | document.querySelectorAll('#loanSelect option').length | count | 
[info]
Executing:  | echo | ${count} |  | 
[echo]
49
[info]
Macro completed (Runtime 4.00s)

我的目标是,如果由于某种原因该数字不是 49,则使用非绿色条目突出显示该数字。

关于如何做到这一点的任何想法?

谢谢!

4

0 回答 0