Consider the following HTML:
<div class="nav-category__col" id="category_nav_level_3" style="display: block;">
<input type="hidden" value="1" name="videogame_type" id="videogame_type">
<ul class="nav-category__list" adparam_name="videogame_type" role="radiogroup">
<li class="nav-category__list-item nav-category__list-item--selected" id="1" tabindex="-1" role="radio" aria-checked="true">
<p class="nav-category__name">Consoles</p>
</li>
<li class="nav-category__list-item " id="2" tabindex="-1" role="radio" aria-checked="false">
<p class="nav-category__name">Jogos</p>
</li>
<li class="nav-category__list-item " id="3" tabindex="-1" role="radio" aria-checked="false">
<p class="nav-category__name">Acessórios</p>
</li>
</ul>
</div>
I want to click on <p class="nav-category__name">Consoles</p> so I tried doing this:
elem = driver.find_element_by_xpath("//*[@id="1"]/p")
elem.click()
I found this xpath by inspecting the element and copying the xpath from it, but it says "Unable to locate element" anyway. How could I do it right?
I don't know very much of HTML, but I am capable of finding other elements by id or by name.