How can I find all custom HTML tags named job-title-text
and it's value(s) Sr Manager
using Selenium in Python? The tag appears multiple times with different values throughout my HTML.
Here's how my HTML looks like:
<a ph-tevent="job_click" ref="linkEle" href.bind="getUrl(linkEle, 'job', eachJob, '', eachJob.jobUrl)" data-ph-at-id="job-link" data-ph-id="ph-page-element-page20-CRUCUZ" job-title-text="Sr Manager" data-ph-at-job-post-date-text="2021-11-23T00:00:00.000Z">
CodePudding user response:
This will give you all web elements containing job-title-text
attribute
all_elements = driver.find_elements_by_xpath("//*[@job-title-text]")
This will give you all web elements containing job-title-text
attribute with value equals to Sr Manager
all_elements = driver.find_elements_by_xpath("//*[@job-title-text='Sr Manager']")