Dec-03-2017, 07:29 AM
hi All,
I tried my code for google page also. I trying to access google search tab. Everyone can ealsiy find HTML page of google page. I am sharing my code and it is returning empty string
I tried my code for google page also. I trying to access google search tab. Everyone can ealsiy find HTML page of google page. I am sharing my code and it is returning empty string
from selenium import webdriver from selenium.webdriver.common.keys import Keys #Getting local session of Chrome driver=webdriver.Chrome() #put here the adress of your page driver.get("https://www.google.co.in") #put here the content you have put in Notepad, ie the XPath '''elem=driver.find_elements_by_xpath('//*[@id]')############### to find id,name replace id,name with class for ii in elem: print(ii.get_attribute('id'))''' elem=driver.find_elements_by_name("btnk")############### this is one of class print(elem) '''elem2=driver.find_element_by_class_name('row') #print(elem2) elementList = elem2.find_elements_by_tag_name("div") print(elementList)''' driver.close()
Output:DevTools listening on ws://127.0.0.1:12452/devtools/browser/02a0e16e-e76a-41a6-850a-0229d267dbcf
[]