I'm trying to scrape a robo advisor website using Selenium in Python. The problem I'm having is that I cannot select and click the elements to answer the required questions despite having tried selection with both CSS selectors and XPATH. I think there is something weird going on here that I'm missing so any help would be greatly appreciated.
The code snippet below shows how to get the survey and attempts to click on the first answer in the time horizon slider. Unfortunately this throws the error: selenium.common.exceptions.NoSuchElementException: Message: no such element.
Sorry the site is in German but if you have any questions just let me know!
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.select import Select
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from time import sleep
# Load Selenium Webdriver
driver = webdriver.Chrome(r'C:\Users\jcgou\PycharmProjects\Master Thesis Robo Advisors\Chrome Driver\chromedriver.exe')
# Navigate to Fintego
fintegoUrl = 'https://www.fintego.de/'
driver.set_page_load_timeout(10)
driver.get(fintegoUrl)
driver.maximize_window()
# Navigate to portfolio recommendation survey
driver.find_element_by_link_text('Depot eröffnen').click()
sleep(3)
# Time Horizon
driver.find_element_by_xpath("//ul[@id='eox_ContentPane_3_Layout_AnlagehorizontBlock_lstAnlagehorizont']//li[2]//i[1]").click()
Here is the HTML if that helps at all. I'm trying to select and click on "1 - 3 Jahre".
<ul class="form name m-deo-form marginBottomDouble">
<li id="eox_ContentPane_3_Layout_AnlagehorizontBlock" class="marginBottom">
<label for="eox_ContentPane_3_Layout_AnlagehorizontBlock_lstAnlagehorizont" class="left selectList-label">
<span id="eox_ContentPane_3_Layout_AnlagehorizontBlock_RequiredfieldvalidatorErfahrung" title="Bitte treffen Sie eine Auswahl" class="validator icon-exclamation" style="color:Red;visibility:hidden;"></span>
</label>
<div class="right">
<ul id="eox_ContentPane_3_Layout_AnlagehorizontBlock_lstAnlagehorizont" class="selectList">
<li class="item stopLightboxSehrKurzfristig" data-value="1" style="width:25%;"><span class="text">Kürzer als 1 Jahr</span><i></i></li>
<li class="item" data-value="2" style="width:25%;"><span class="text">1 - 3 Jahre</span><i></i></li>
<li class="item" data-value="3" style="width:25%;"><span class="text">3 - 7 Jahre</span><i></i></li>
<li class="item" data-value="4" style="width:25%;"><span class="text">Länger als 7 Jahre</span><i></i></li>
</ul><input type="hidden" name="eox_ContentPane_3$Layout$AnlagehorizontBlock$lstAnlagehorizont_ValueContainer" id="eox_ContentPane_3_Layout_AnlagehorizontBlock_lstAnlagehorizont_ValueContainer">
</div>
</li>
</ul>