**Only two find methods show up. I don't seem to know where the issue is coming from[1]
Please see the picture in the link below for better understanding [1]: https://i.stack.imgur.com/GGoBC.png
CodePudding user response:
The class you're using doesn't have that as a method. You can verify this in the docs. https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/WebDriver.html
Not sure what you're trying to do and how else to help, maybe you're looking for another class, or you can use the existing find_element method?
CodePudding user response:
There is no such method provided by Selenium. find_element_by_id is robot framework implementation for its SeleniumLibrary. Way to locate by id:
from selenium.webdriver.common.by import By
driver.find_element(By.ID, 'loginForm')
CodePudding user response:
The method that you've provided or are trying to search find_element_by_id
was provided in the Selenium 3 documentation and could have been used like
driver.find_element_by_id('element_id')
However, starting Selenium 4, these methods are deprecated. So now to use any kind of locator, you need to have driver.find_element(By.ID, "id")
from seleniumwire import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
svc = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=svc)
driver.maximize_window()
driver.get("https://www.amazon.com/") #url that needs to be passed
elem = driver.find_element(By.ID, "element")
elem.click()
driver.quit()