Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Document for "Locator strategies" does explain what is "By" #1393

Closed
HGtz2222 opened this issue May 27, 2023 · 5 comments
Closed
Labels
bug Something isn't working documentation Improvements or additions to documentation needs-triaging

Comments

@HGtz2222
Copy link

What happened?

https://www.selenium.dev/documentation/webdriver/elements/locators/

In this page, the demo code show how to locator an element, such as:

driver.find_element(By.CLASS_NAME, "information")

But I cannot see what is the "By", and how can I import "By" in my code.

If I use Java, IDE can help me generate code to import "By" . But if I use Python, most IDE cannot do such thing.
So I hope the document can add the import statement for these key identifiers such as "By".

Thanks very much!

What browsers and operating systems are you seeing the problem on?

uncorrelated

@HGtz2222 HGtz2222 added bug Something isn't working needs-triaging labels May 27, 2023
@github-actions
Copy link
Contributor

@HGtz2222, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@titusfortner
Copy link
Member

So, first, we are trying to move away from static code, and move all examples to our repo.
But even in our repo we are trying to only import the lines of code that matter. At least this way there will be a big link to see the full example.

At the same time, I'm leaning towards us just using the full path for classes instead of doing imports to make it more obvious where it is coming from.
e.g.:

webdriver.common.by.By.ID

@eaccmk
Copy link
Contributor

eaccmk commented Sep 2, 2023

So do we thing this is a bug and need a fix or CR ?

@HGtz2222 I see for Python you can import By using

from selenium.webdriver.common.by import By

@titusfortner
Copy link
Member

Yes, we should either do the full path for it, or include the import line in a second reference.

@asolntsev asolntsev added the documentation Improvements or additions to documentation label Sep 9, 2023
diemol pushed a commit that referenced this issue Aug 22, 2024
added section for ticket 1393

[deploy site]
selenium-ci added a commit that referenced this issue Aug 22, 2024
added section for ticket 1393

[deploy site] 7ba611e
@diemol
Copy link
Member

diemol commented Aug 22, 2024

Closed via #1880

@diemol diemol closed this as completed Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation needs-triaging
Projects
None yet
Development

No branches or pull requests

5 participants