I need to locate an id tag within a class tag on an html page.
driver.find_element(By.XPATH, "//div[@class='Content warning']/p").get_attribute("id")
https://i.stack.imgur.com/NlU8t.png
I successfully accomplished this with selenium using the following instruction:
driver.find_element(By.XPATH, "//div[@class='Content warning']/p").get_attribute("id"))
Although it works well, it is a bit slow. I am interested in trying a javascript code injected directly into the page using a code injector.
Therefore, I am seeking the equivalent of the selenium instruction in javascript.