Тёмный

How to get text and attribute in Selenium? 

CYDEO
Подписаться 4,6 тыс.
Просмотров 283
50% 1

How to get text and attribute of an element in Selenium. There are two methods for this: `getText` and `getAttributes`. When we want to get the text of an element, we use the `getText` method. This method doesn't accept any argument, and it will return the text of the provided web element as a string. The return type is also a string. To use it, we will be using the web element like this: `webElement.getText()`, and it will give us the text of the web element, which is the content between the opening and closing tags of that web element.
When we want to get the attribute of a web element, we use the `getAttributes` method. This method accepts a string argument, which is the attribute name whose value we want to retrieve. It will find the matching attribute name and return its value as a string. The return type is a string, and it will fetch the value of the attribute from the opening tag.
Please hit the like button if you find this video helpful, and consider subscribing to our channel if you want to stay connected. Also, please let me know in the comment section which UI test automation interview questions you'd like me to cover next. Thank you so much, and see you all in the next video.
#selenium #attribute #coding
Website: cydeo.com/
Instagram: / cydeo
Linkedin: / cydeo-official
Twitter: / cydeo_official
Facebook: / cydeo.official

Опубликовано:

 

16 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии