简体   繁体   English

Python Selenium查找随机生成的元素ID

[英]Python Selenium Find Randomly Generated Element ID

I have looked a few solutions on this issue on stackoverflow. 我已经在stackoverflow上找到了一些有关此问题的解决方案。 Although I cannot seem to find working solution. 虽然我似乎找不到可行的解决方案。

  1. There are ton of elements with the id prefix "ext-gen" so most of the answers I have seen will not work. ID前缀为“ ext-gen”的元素很多,因此我看到的大多数答案都行不通。

Here is the HTML 这是HTML

<input type="submit" value="New Player Arrived" id="ext-gen1084">

I'm trying to find this element and then return its value with 我试图找到这个元素,然后用

get_attribute('value')

您可以使用以下内容查找随机生成的元素ID:

driver.find_element_by_css_selector("input[type='submit']")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM