'extracting the desired link and its order from the links taken with selenium
from selenium import webdriver
import time
driver = webdriver.Chrome("chromedriver.exe")
driver.get('https://www.google.com.tr/search?num=100&q=istanbul%20hastaneleri')
link = driver.find_elements_by_xpath("//div[@class='yuRUbf']/a")
sayac = 0
for i in link:
sayac += 1
s = str(sayac) + "-"
z = (i.get_attribute("href"))
t = s + z
print(t)
driver.close()
I have searched on Google but did not come across a solution. With the codes above I can retrieve the rank of the websites and all of the links. Among the 100 websites I have retrieved, how will I be able to retrieve one specific website and rank of it?
Example: out of 100-102 links taken 25th place https://www.sjh.com.tr/ pull the link.
Thank you in advance for your help
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|