Search code examples
seleniumselenium-webdriverselenium-chromedriverfindelement

Unable to locate 3rd div element


driver.find_elements(By.XPATH, '/html/body/div[1]/div/div[6]/div[1]/div[2]/div[2]')

The above element is returned by the selenium chrome driver but the below element (div with main-content-row class) is not.

driver.find_elements(By.XPATH, '/html/body/div[1]/div/div[6]/div[1]/div[2]/div[3]')

enter image description here


Solution

  • Try providing the relative xpath,

    driver.find_elements(By.className,'main-content-row')
    

    or

    driver.find_elements(By.XPATH,"//div[@class='main-content-column']/div[3]")
    

    Note: The XPaths can be incorrect because the given information are not enough to provide the exact relative XPath. Please do the modifications you need if it is not working.