Skip to content

GetAttribute.cs

Avrigeanu Laurian edited this page Apr 11, 2023 · 2 revisions

GetAttribute(string selector, string attributeName, bool lockToLastPage = false)

Gets the value of an attribute of an element specified by a selector on a page.

Parameters

  • selector : A string value representing a selector for the element.
  • attributeName : A string value representing the name of the attribute to get the value of.
  • lockToLastPage : A bool value indicating whether to lock to the last page. Default is false.

Returns

A string value representing the value of the specified attribute.

Remarks

This method first calls the FindElement method passing selector and lockToLastPage parameters to locate the element on the page. It then calls the GetAttributeAsync method of the located IElementHandle object with attributeName to get the value of the specified attribute. The method blocks until the value has been successfully retrieved before returning the string value representing the value of the attribute. The Log class is used to write an information message to the log indicating that the attribute value has been retrieved.


GetAttribute(IElementHandle element, string attributeName)

Gets the value of an attribute of an IElementHandle object.

Parameters

  • element : An IElementHandle object representing the element to get the attribute value of.
  • attributeName : A string value representing the name of the attribute to get the value of.

Returns

A string value representing the value of the specified attribute.

Remarks

This method calls the GetAttributeAsync method of the provided IElementHandle object with attributeName to get the value of the specified attribute. The method blocks until the value has been successfully retrieved before returning the string value representing the value of the attribute. The Log class is used to write an information message to the log indicating that the attribute value has been retrieved.

Clone this wiki locally