セレクタに
変数を渡すのはとても簡単です。ユーザはMustache(https://mustache.github.io/mustache.5.html) 構文を使って既存のパラメータに値を追加するか、セレクタの
内部でカスタムパラメータを使用することができます。
この例では、Recorder を使って Google Search ページ内の要素をキャプチャし、既存のSelector
パラメータに追加する変数を渡します。
ユーザーは、Google(https://www.google.com/)の
メインページで検索したい検索入力を自由に入力することができます。この場合、作者はrabbitmqを
選択しました。

ここで、ユーザーはOpenRPAを開き、新しいワークフローを作成する必要があります。筆者は「Manually Adjusting Selectors
」と名付けました。
Sequenceの
中をクリックし、OpenRPAのリボン内にあるRecorderボタンをクリックします。次に、ページ内の要素内をクリックします。

ユーザーがInternet Explorerを
使用している場合は、新しいOpenRPA.IE.GetElementActivityが表示されます。一方、ユーザーがEdge
、Chrome
、Firefoxを
使用している場合、新しいOpenRPA.NM.GetElementアクティビティが表示されます。

ここで、ユーザーは「セレクタを開く」ボタンをクリックする必要があり、セレクタ デザイナーが
表示されます。

現在、ユーザーはxpath
パラメータの一部のみを置き換えることになります。xpath
パラメーターのdiv/span/span[2]
部分を取り除き、取り除いた値を代入する変数名を含むMustache 式
を
追加します。著者はその変数の名前をselectorValue
にしたので、Mustache
式は
{{selectorValue}}
になる。
この後、ユーザーはOkボタンをクリックしてセレクタ デザイナーを
閉じることができます。


ここでユーザーはこの変数に値を代入する必要があります。値はxpath
パラメータから取り除かれた値ですが、何でもかまいません。
操作の可能性は無限大。CSS セレクタを
使うこともできます。詳しくは「CSSセレクタの使い方」をご覧ください。
Assignアクティビティをメインシーケンスにドラッグし、GetElementアクティビティのすぐ上に置きます。selectorValueという
名前を付けて、前に取り除かれた値、つまり「div/span/span[2]
」を代入してください。Ctrl+K
キーを押して、変数を作成します。

ここで、GetElementアクティビティのSequence
内のClick Elementアクティビティを削除し、その中にAssignアクティビティをドラッグして、値が本当にキャプチャされたかどうかをテストできるようにします。
selectorTextという
変数に名前を付ける – これは完全に任意の値で、ユーザーは実際に好きな名前を付けることができます。
この変数にitem.Textを
代入します。

最後に、「通知を表示」アクティビティをメインシーケンスにドラッグし、その「メッセージ
」入力フィールドにセレクタテキストを
挿入します。

今、ワークフローを実行すると、取得したメッセージを含む通知が
表示されます。
