Dec-07-2017, 04:37 AM
Hi hashivaraj,
I tried what u have mentioned and as per my understanding it is working fine. Please correct me if I am wrong .
I tried what u have mentioned and as per my understanding it is working fine. Please correct me if I am wrong .
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://files.fm/") #put here the content you have put in Notepad, ie the XPath #elem=driver.find_elements_by_xpath( '//*[@id="tsf"]/div[2]/div[3]/center/input[1]')############### this is one of name #elem.send_keys("google search through python") '''for e in elem: e.send_keys("google search through python")''' #elem2=driver.find_element_by_id('file_upload').send_keys("C:\\Users\\pubhatia\\Documents\\learning\\python\\call_url.py") #print(elem2) elem2=driver.find_element_by_id('file_upload') print(elem2) elem2.send_keys("C:\\Users\\pubhatia\\Documents\\learning\\python\\call_url.py") driver.close()
Output:DevTools listening on ws://127.0.0.1:12834/devtools/browser/3cfbab60-fd17-4582-979f-5cc172054f54
<selenium.webdriver.remote.webelement.WebElement (session="498744c3b6f8c6219d4f6c85c11e66e2", element="0.4471727654327058-1")>