Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть ✔ getAttribute vs getText (What's The Difference In Selenium) | (Video 12)

  • Rex Jones II
  • 2018-11-11
  • 10681
✔ getAttribute vs getText (What's The Difference In Selenium) | (Video 12)
Selenium TutorialSelenium TrainingSelenium Testing TutorialSelenium Online TrainingSelenium IntroductionSelenium FrameworksLearn SeleniumSelenium Testing ToolSelenium Tutorial For BeginnersSelenium AutomationTest AutomationSelenium BasicsSelenium Step By StepSelenium ComponentsSelenium TipsSelenium OverviewSelenium FundamentalsSelenium 4 BeginnersSelenium For Beginners
  • ok logo

Скачать ✔ getAttribute vs getText (What's The Difference In Selenium) | (Video 12) бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно ✔ getAttribute vs getText (What's The Difference In Selenium) | (Video 12) или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку ✔ getAttribute vs getText (What's The Difference In Selenium) | (Video 12) бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео ✔ getAttribute vs getText (What's The Difference In Selenium) | (Video 12)

What’s the difference between getAttribute and getText methods in Selenium? That question is asked on the internet via sites like #StackOverflow. getAttribute get values of specific attributes while getText gets values between starting and ending HTML tags. Here’s the description of both elements:

✔ getAttribute - Get the value of a specified WebElement attribute
✔ getText - Get the visible innerText attribute of a WebElement

Sometimes HTML does not contain an ending tag. Therefore, getText returns the value after the starting tag. An element such as a place holder does not return a value using the getText method. This video demos the difference between getAttribute and getText which are 2 of 16 Selenium WebElement Methods.

► Download Presentation, Automation Code and Test Cases = https://tinyurl.com/SeleniumWebElemen...

► Free Selenium PDF Book: https://www.rexjones2.com/book-seleni...
► Free Java PDF Book: https://www.rexjones2.com/book-part-1...
► All Paperback & eBooks: http://tinyurl.com/Rex-Allen-Jones-Books

► Increase Video Quality: Settings - Quality - Select HD
► CC Font Size: Settings - Subtitles/CC - Options - Font Size
► Turn CC On or Off: Click CC

► Transcript
The next WebElement Method is getText. We are going to get the error message that shows up after clicking the Sign In button. First we find the error message: driver.findElement by xpath next we get the error message: dot getText. The description states “Get the visible innerText of this element”. This description can be confusing if you don’t know HTML.

Let me use W3 Schools to help explain the getText method and HTML. www.w3Schools.com / Learn HTML / Introduction. Do you see how tag name has an opening and closing tag? The only difference is closing tag has a forward slash before tag name. Content goes here. The getText method returns the content between the opening tag and closing tag. Sometimes HTML does not contain a closing tag. HTML tags normally come in pairs. That means the closing tag is not required.

Go back to our Application Under Test. Let’s inspect the error message. In this case, the error message is between the opening and closing h4 tags. Copy and Paste xpath value
The getText method returns a String so let’s assign the value to String strErrorMessage. Now, let’s print the error message. Sysout “What Is The Error Message? ” + strErrorMessage. Let’s Run / What Is The Error Message? Please enter your password

To summarize, the getText method. It will return most data you see on a web page. It will not return data if there’s no content after the opening tag. For example, the Password placeholder will not return data if we use the getText method. Although we see Password on our application, it does not have content. There is no content after the opening tag. The blue highlighted section is the opening tag for input which have 5 Attribute Names and Values.

Let me show you how getText will not work for this element: driver.findElement By id “password” dot getText. Assign the value to String strPlaceHolder. Sysout / getText = “I Will Enter My “ + strPlaceHolder. Let’s run

The Console does not show data after I Will Enter My. We must use the getAttribute method when we see data on an application but HTML does not have content for that element. I will use the same code and change getText to getAttribute. Copy and Paste. Change getAttribute method and getAttribute within the print statement. Also change the object reference strPlaceHolder to strPasswordLabel.

Add double quotes to the getAttribute value. The description states “Get the value of the given attribute of the element.” That mean we can get any value by writing the attribute name. Let’s verify which attribute name has the attribute value Password.

The placeholder attribute has the Password value we want to print. There are multiple attributes with password as a value but we need placeholder because it has a capital “P” for Password. Attributes type, id, and name contains a lowercase “p” for Password which does not match the application. Let’s run again / getAttribute displays I Will Enter My password.

You can download your Presentation, Automation Code, and Test Cases at https://tinyurl.com/SeleniumWebElemen...

#SeleniumTraining #SeleniumAutomation #BeginnerSeleniumTutorials #SeleniumWebDriver

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]