Reputation: 11
I wish I could get the text below but what I got is ''.
Any tips to go further? This is my code and the following is from the source page.
x = element.find_elements_by_xpath('//*[@id="detailsContent"]/div[2]/ul/li[5]/span[3]')[0].text
<span class="text-sm md:text-base text-primary cursor-pointer hover:underline" onclick="$(this).swapWithNext();gaTrack('Interact', 'MoreDetails-Show', 'NAICS Code', 1, true);">show</span>
<span class="text-sm md:text-base hidden">332992, Small Arms Ammunition Manufacturing</span>
Upvotes: 1
Views: 397
Reputation: 12499
To get the text, try using get_attribute("innerHTML")
Example
x = element.find_elements_by_xpath(
'//*[@id="detailsContent"]/div[2]/ul/li[5]/span[3]'
).get_attribute("innerHTML")
Upvotes: 1