Skip to content
Advertisement

Can not access array element in Python comming from Xpath

I am trying to cycle through an array in python:

JavaScript

Somehow this does not work as it always is accessing the first element. Looking into the xpaths manually I do get the following:

JavaScript

Accessing the element directly (note 8=7 due to 0), I am able to get it. Just cycling through it does not work out.

It cycles correclty n amount of times, but I am always getting the first element.

Advertisement

Answer

I guess you want selector.xpath('.//a[@class="name"]/@href').extract_first().

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement