-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Description
What happened?
In the example instructions for getting started with Selenium, here, it instructs you to: "Request element information" (see step 7). The example script it points to here allegedly does this with the line:
message = driver.find_element(by=By.ID, value="message")
However, all this does is create the message object. It does not collect any information about the message or verify any of that information. This line will cause the script to crash if the message doesn't exist, but it's a misleading example for new users of Selenium.
This can be easily fixed by changing this line to something that actually requests some information about the message element rather than just creating it, e.g.
message = driver.find_element(by=By.ID, value="message")
assert message.is_disaplayed()
How can we reproduce the issue?
Read [first_script.py](https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk/examples/python/tests/getting_started/first_script.py#L18) and decide if line 18 is actually requesting any information about the element (and why according to the same documentation, line 12 and line 13 are not).Relevant log output
Not applicable, I don't think.Operating System
Windows 11
Selenium version
Python, selenium 4.25.0
What are the browser(s) and version(s) where you see this issue?
Not applicable
What are the browser driver(s) and version(s) where you see this issue?
Not applicable
Are you using Selenium Grid?
No response