selenium-python icon indicating copy to clipboard operation
selenium-python copied to clipboard

Add locator deprecation warning and additional examples

Open anotherkowski opened this issue 3 years ago • 6 comments

Selenium 4.0.0 deprecates find_element_by_* methods. This PR makes a handful of edits to address that:

  • Add notice to introduction about deprecated methods
  • Add table of locator methods to page introduction
  • Add additional examples with preferred methods under each locator example
  • Add additional XPath browser extensions
  • Move and convert inline notes into comments directly beneath relevant code block
  • Add relevant alerts/notices as footnotes to improve readability

anotherkowski avatar May 25 '22 23:05 anotherkowski

Note: I did not remove the legacy find_element_by_* locator methods because they do still behave as expected for earlier versions of Selenium, though if used they will print a warning to the console:

DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead.

anotherkowski avatar May 25 '22 23:05 anotherkowski

@baijum @anarang - PR for consideration at your convenience

anotherkowski avatar May 26 '22 00:05 anotherkowski

@anotherkowski thanks for raising the PR. The changes about the deprecation notice and the table look good to me at the top and once at the bottom of the PR. However, I am not sure of the cosmetic changes to the text that you propose, changing '' to ``, there is some inconsistency there.

anarang avatar May 31 '22 10:05 anarang

@anotherkowski Thanks for the PR! Now that I have merged a similar PR #99 So, can you please rebase your PR branch?

Also, the reStructuredText changes should be a separate PR.

Thanks for @anarang for the review!

baijum avatar May 31 '22 11:05 baijum

@anotherkowski thanks for raising the PR. The changes about the deprecation notice and the table look good to me at the top and once at the bottom of the PR. However, I am not sure of the cosmetic changes to the text that you propose, changing '' to ``, there is some inconsistency there.

Absolutely - understood. I will revert them for consistency's sake with the rest of the docs.

anotherkowski avatar May 31 '22 16:05 anotherkowski

Rebased, resolved conflicts, and reverted the rogue `` into " at @anarang's suggestion. I maintained the table at the top of the Locating Elements page, but also preserved the updates made by @dysphere.

Please let me know if there are other things I can do to shore up this PR. I appreciate your consideration!

anotherkowski avatar Jun 02 '22 13:06 anotherkowski

I closing this PR for now. Please reopen once the review comments are addressed.

baijum avatar Dec 13 '22 13:12 baijum