Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98711

Nested elements in selenium... do I need to get all of them?

$
0
0

I'm doing some scraping and automation using selenium. My question is exactly what I putted on the title. Say I have something like:

<div id = "dsopdoaspdk"><div id = "owpowqkeqwop"><div id = "wewqopewqkeop"><div class = "kdmkdmqwopeop"><span class = "wopqqwope"><a id = "dlopkeop">

and I want to get only the a class for clicking in the link. On the XPATH I have to put all the divs nested or can I get something like getting only the most outer div("dsopdoaspdk") and the <a id? or, better, can I get something like find_element(By.ID, "dlopkeop") ignoring all the divs?

I'm trying to reduce the amount of code not putting all these long div class names.


Viewing all articles
Browse latest Browse all 98711

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>