Python Selenium using For Loop to assess element

  for-loop, python, selenium

Basically I want all info from Others page from the first page to the last, I try:

The website’s a bit strange..I want get all issuer and other info under ‘POST ISSUANCE’

driver.get('https://www.chinabondconnect.com/en/Primary/Primary-Information/Onshore.html')
wait = WebDriverWait(driver, 30)
driver.find_element_by_link_text('Others').click()
for i in range(1,20):
        pg = "tb2tr pg" + str(i)
        allitems = driver.find_element_by_xpath('//*[@id="td7"]/tbody/tr[@class=pg])')
        for i in range(len(allitems)):
            issuer = driver.find_element_by_xpath('(//tr[@class=pg]//td[1]//div[2]//div)').text
            print(issuer)

it says not a valid xpath..

Could someone help with this?

Thanks!!

Source: Python Questions

LEAVE A COMMENT