Alpha Kenny Buddy
Alpha Kenny Buddy

Reputation: 132

Python selenium formating brackets xpath

I'm having a problem with xpath finding element I need.

Here's html code im trying to find.

name="itemData[analysis][0][Pd]"

And that's how I'm trying to find it

def find(driver,path):
element = WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.XPATH, path)))
return element
element = find(driver, "//input[@name='itemData[analysis].[0].[Pd]'").send_keys(1)

I know the problem is in how I format, the path, but I have no idea how to format it correctly.

Upvotes: 2

Views: 84

Answers (1)

cruisepandey
cruisepandey

Reputation: 29372

Make use of XPATH contains here :

//name[contains(@name, 'itemData[analysis][0][Pd]')]

or

//name[contains(@name, 'itemData')]

or

//name[contains(@name, 'itemData[analysis]')]

and so on..

Upvotes: 1

Related Questions