Click
node)Open
node)Find Tab
node)Execute Function
node)bot-command
node on the editor, double click on it and configure it like shown below (if this is unfamiliar to you, you might wanna go over this more basic tutorial covering the basics of skill building).query
on YouTube. If you notice, searching for a query on YouTube is the same thing as navigating to youtube.com/results?search_query={query}
function
node (you'll find it at the top of the pallette) on to the editor and connect it to our bot-command
node. Double click on this node and put this code inside -searchUrl
) to the msg
object forwarded by this node. We can now access this URL in other nodes.Open
node (from the Maya Browser Automation module) to the editor, and double click on it.searchUrl
property of the msg
object. So, select "msg." from the left dropdown on the "url" property and put "searchUrl" in the text input on the right of the dropdown.Open
node will add a property called tabs
to the msg
object, which is an array containing a single Tab
object corresponding to the browser tab that was just opened. A Tab
object contains these properties. This will be useful in a bit.<a id="thumbnail">
. The corresponding xpath for this element would then be:Click
node to click on it. First, drag a Click
node to the editor and double click on it. You'll should see something like this in the node's config panel.selector
are filled out for us already, and we can leave them as is. Notice how tabId
is set to msg.tabs[0].id
. The msg.tabs
property was set by the Open
node that comes right before this node, remember? We access the id
of the tab we just opened through tabs[0].id
.Click
node to the Open
node before it. The flow should now look like below. The only thing we need to do now is to notify the command bar that the skill has finished executing.bot-response
node (from the botutils
module) to the editor and connect the Click
node to it. Your skill should look like this:<video>
element's pause()
method on the YouTube tabExecute Function
node works hehe). Here's the steps we need to take -<video>
element's pause()
method on this tab.bot-command
node should look like -Execute Function
node performs a page-automation action (i.e., does something with the website's interface). All page-automation actions require you to specify the ID of the tab on which you want to perform them. In our case, we need the ID of the tab which is playing the YouTube video.Find Tab
node to the editor and double click on it. There's just one field - "query". This is a JSON field that will contain a standard chromium tab query. You can check out what a query can contain at this MDN page. We want a tab whose URL is of the pattern *://*.youtube.com/watch*
and is producing some sound. Here's the corresponding tab query:Find Tab
node to the bot-command
node. The Find Tab
node will set a property called tabs
on the msg
object, containing an array of Tab
objects that match the query. Ideally, only one tab should match the query (what kind of a psychopath has two audible youtube videos playing at once?), so we'll just select the first element of this array.pause()
method, and the YouTube player is no different. The Execute Function
node is used exactly for things like this, so drag it out to the editor and double click on it.<video>
tag. Since there is only one <video>
element on the entire page, it's xpath is simply //video
. That's what we'll put in the "selector" field.pause()
function takes no arguments, we can just set an empty JSON array ([]
) in the "arguments" field. The "tabId" field is already set to use the value msg.tabs[0].id
, which is what we want. The node config should finally look like this -Execute Function
node to the Find Tab
node. The skill should finally look like this at this point -bot-response
node to the editor and connect it to the Execute Function
node. The final skill should look like this:play()
function instead of the pause()
function and in our tab query we won't be looking for an audible tab (since the tab ideally won't be playing anything). For this, just remove "audible": true
key from the tab query in the Find Tab
node.