'How can I click on each link on a page and then return to the initial page using Robot Framework?
I have this link : https://pubmed.ncbi.nlm.nih.gov/?term=Fleiss+B and I want to click on each link, extract some information and then comeback to the initial page. So far I managed to make 2 for loops that go through all pages and extract the links from each page.
'''
${nrpag} Get Element Attribute class:page-number max
Log To Console ${nrpag}
FOR ${j} IN RANGE 1 ${nrpag}
${links_nr}= get element count xpath://a[@class="docsum-title"]
Log To Console ${links_nr}
@{links} Create List
FOR ${i} IN RANGE 1 ${links_nr}
${linktext}= Get text xpath:(//a[@class="docsum-title"])[${i}]
${idk}= writetextlinks ${linktext}
${elements}= Get WebElements //a[@class="docsum-title"]
${href}= Get Element Attribute xpath=(//a)[${i}] href
${p2}= writeLinks ${href}
Log to console ${linktext}
END
Click Button xpath://button[@class="button-wrapper next-page-btn"]
END
'''
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|