Lets say I have a list of links and want to click a link at random:
<div id="divA">
<a> first link </a>
<a> second link </a>
...
</div>
It isn't the smartest of ways (and if you have a better solution please tell me) but what I currently do is (roughly):
l = []
for i in range(numOfLinks):
xpath = '//div[@id="divA"]/a[%d]'%i
txt = sel.getText(xpath)
l.append(xpath, txt)
xpath,linkName = random.choice(l)
sel.click(xpath)
The main problem of this solution is that it sends many requests to selenium. My question is: is there a way of saving all these requests in a buffer and sending them at once?