This section introduces methods that can be used on the akaBot Portal's top page. For information on how to evaluate XPath, please refer to the section "Evaluating XPath."
1. XPath to Specify id Attributes
This is the method for writing XPath by specifying the id attribute. Since the id attribute is unique within a document, you can write an XPath that specifies a single element by using a conditional statement that equals the value of the id attribute.
xpath
[@id="value_of_the_desired_id_attribute"]
Example: XPath for an element with an id attribute value of "custom-blocks" within the document:
xpath
//*[@id="custom-blocks"]
2. XPath to Specify Text Nodes
By using the text() function, which evaluates the type of node, you can specify elements that contain a particular text node. Here are some commonly used XPath methods that use text().
Specifying an Element that Exactly Matches the Specified Text Use the = operator to specify an element that exactly matches the specified string.
Example: XPath that specifies an element containing the text node "How to use akaBot":
xpath
//*[text()="How to use akaBot"]
Note: The element obtained on the top page of the akaBot Portal will be a single item.
Specifying an Element that Contains the Specified Text Use the contains function to specify an element that contains the specified string. This function designates elements where the string in the first argument includes the string in the second argument.
Example: XPath that specifies an element containing the string "akaBot" in the text node:
xpath
//*[contains(text(), "akaBot")]
Note: The elements obtained on the top page of the akaBot Portal will include multiple elements that contain the string "akaBot."
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article