How to locate web elements with similar attributes [duplicate]

馋奶兔 提交于 2021-01-06 00:07:13

问题


I am performing automation on a web page, the problem is i cannot locate a web element because it has identical attributes to that of other 20 web elements with similar parents and children, with one dynamicity i.e the id, which changes every time i refresh the page. How do i locate the web element?

    for z in web_elements:
        print(z.get_attribute("innerHTML"))
    width = browser.find_element_by_xpath('//input[contains(@class, "cke_dialog_ui_input_text")]')
    width.click()

I tried searching for the web element using loops no success though

来源:https://stackoverflow.com/questions/65540342/how-to-locate-web-elements-with-similar-attributes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!