# How to find element by xxx

**URL:** <https://forum.robotframework.org/t/how-to-find-element-by-xxx/4697>\
**Category:** Robot Framework\
**Created:** [14 September 2022 07:03 UTC](https://forum.robotframework.org/t/how-to-find-element-by-xxx/4697 "2022-09-14T07:03:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BigLez](https://avatars.discourse-cdn.com/v4/letter/b/e480ec/32.png) [@BigLez](https://forum.robotframework.org/u/BigLez)\
**Post date:** [14 September 2022 07:03 UTC](https://forum.robotframework.org/t/how-to-find-element-by-xxx/4697/1 "2022-09-14T07:03:07Z")

</div>

Hello, Ive just noticed ${row.find\_elements\_by\_tag\_name(‘td’)} is deprecated.  
Can anyone give me the new way this works as ive tried ${row.find\_element(‘xpath’)} and Im not sure how to get it working ( tried different combinations and other bits I found on the internet but couldnt get any to work)  
Many thanks in advance

---

<div class="post-metadata">

**Author:** ![Wolfe1](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/wolfe1/32/3386_2.png) [@Wolfe1](https://forum.robotframework.org/u/Wolfe1)\
**Post date:** [14 September 2022 18:19 UTC](https://forum.robotframework.org/t/how-to-find-element-by-xxx/4697/2 "2022-09-14T18:19:50Z")

</div>

> <https://github.com/SeleniumHQ/selenium/blob/64447d4b03f6986337d1ca8d8b6476653570bcc1/py/test/selenium/webdriver/common/children_finding_tests.py#L35>

---

<div class="post-metadata">

**Author:** ![BigLez](https://avatars.discourse-cdn.com/v4/letter/b/e480ec/32.png) [@BigLez](https://forum.robotframework.org/u/BigLez)\
**Post date:** [16 November 2022 09:49 UTC](https://forum.robotframework.org/t/how-to-find-element-by-xxx/4697/3 "2022-11-16T09:49:20Z")

</div>

@Wolfe1 Hi cheers for the help, im having trouble getting to recognise find\_element

error message: AttributeError: module ‘selenium.webdriver’ has no attribute ‘find\_element’  
Code is below:  
from selenium.common.exceptions import (  
WebDriverException,  
NoSuchElementException)  
from selenium.webdriver.common.by import By  
from selenium import webdriver as driver

class pythontest(object):  
ROBOT\_LIBRARY\_SCOPE = “GLOBAL”

```
def __init__ (self):
    # self.driver = webdriver.chrome(r"C:\NMSAutomationSuite\NMSAutomationSuite\chromedriver.exe")
    pass 

def find_element_by_tagname(self, elements, tag_type):
    element = driver.find_element(By.TAG_NAME, tag_type)
    return element

```

---

<div class="post-metadata">

**Author:** ![Wolfe1](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/wolfe1/32/3386_2.png) [@Wolfe1](https://forum.robotframework.org/u/Wolfe1)\
**Post date:** [16 November 2022 13:51 UTC](https://forum.robotframework.org/t/how-to-find-element-by-xxx/4697/4 "2022-11-16T13:51:40Z")

</div>

So your “driver” is actually going to be the webdriver running the automation so generally that will be passed in like the example from the tests.

If you for sure just want to use the chrome, Firefox, remote, etc driver then it would be something like this (for chrome):

```
from selenium.webdriver.chrome.webdriver import WebDriver

driver = WebDriver()
driver.find_element()

```
