Finding elements by xpath pattern in Selenium python -


i working selenium python , lettuce test django application.

there many elements having xpath in following pattern , don't know how many of these elements exists in document.

.//*[@id='accordion-note-1'] .//*[@id='accordion-note-2'] .//*[@id='accordion-note-3'] .//*[@id='accordion-note-4'] 

is there way use pattern in driver.find_elements_by_xpath ?
purpose items having pattern of xpath.

not sure work, can try using below xpath:

.//*[starts-with(@id, 'accordion-note')] 

here link http://www.zvon.org/xxl/xsltreference/output/function_starts-with.html

u can use contain here like

.//*[contains(@id, 'accordion-note')]      

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -