0

I have looked a few solutions on this issue on 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.

Here is the 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')
bzret
  • 19
  • 5
  • If you don't know the exact id of the element you're looking for, how will you know when you've found it? Are you always looking for an `` element? Can there be more than one of those with an id prefix of `ext-gen`? – John Gordon Sep 01 '18 at 23:51
  • Well I'm using xpath to find some elements so I don't need the id. Although to answer your question this is the only element on this page that has a . I don't know how to find elements by input type. Plus the xpath includes it's randomized id. – bzret Sep 01 '18 at 23:59
  • Possible duplicate of https://stackoverflow.com/a/103417/2834978 or https://stackoverflow.com/a/6055530/2834978 – LMC Sep 02 '18 at 00:08
  • Sorry everyone, I've found a solution on my own using css selectors. driver.find_element_by_css_selector("input[type='submit']") – bzret Sep 02 '18 at 00:22

1 Answers1

0

You can use the following to find a randomly generated element ID:

driver.find_element_by_css_selector("input[type='submit']")
Grant Miller
  • 27,532
  • 16
  • 147
  • 165
bzret
  • 19
  • 5
  • 2
    This does not actually answer a question *"How to find element with random ID"* , but *"How to find Submit button"* – Andersson Sep 02 '18 at 07:00