Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
jeevitha
Posts : 1
Join date : 2014-06-27

sendkeys is not working for file upload Empty sendkeys is not working for file upload

Fri Jun 27, 2014 8:45 pm
Hi,

I am using firefox version 30.0 with selenium IDE version 2.5.0.

I started the recording for the website http'colon''slash''slash'pdf2jpg'dot'net
Clicked 'Choose a PDF file'.  Uploaded a file from my machine.
Clicked 'Convert PDF to JPG'.
Stopped the recording and Exported Testcase as 'Python2 / Unitest / Webdriver'.

In the recorded py file, the contents are like this:

Code:
   def test_pdf(self):
        driver = self.driver
        driver.get(self.base_url + "/")
        driver.find_element_by_id("advanced_pdf_file").click()
        driver.find_element_by_id("html5_18rendrprhrsv8nonqc521tal3").clear()
        driver.find_element_by_id("html5_18rendrprhrsv8nonqc521tal3").send_keys("")
        driver.find_element_by_id("convert_pdf_to_jpg_button").click()    

When I replayed the script, the file name that I entered did not come again.
In the above code, I edited the send_keys line with

Code:
driver.find_element_by_id("html5_18rendrprhrsv8nonqc521tal3").send_keys("C:\\pdfurl-guide.pdf")

Even then, the file name text box is coming blank, and script is not proceeding after that.  Please help me in uploading the file.

Thanks in advance.
Jeevitha.
avatar
mail2prassad
Amateur
Amateur
Posts : 41
Join date : 2013-06-05

sendkeys is not working for file upload Empty Re: sendkeys is not working for file upload

Fri Jul 18, 2014 7:43 pm
It looks like the IDs are generated dynalically ('html5_18rendrprhrsv8nonqc521tal3' - not a general static id). This might be the reason the filename is appearing blank.

Try reloading the page couple of times and see whether the ID remains same.
avatar
nabhanya.varma
Active particpant
Active particpant
Posts : 13
Join date : 2014-03-02

sendkeys is not working for file upload Empty Re: sendkeys is not working for file upload

Sat Sep 13, 2014 5:37 pm
If not with the dynamic ID, please check if that has a tag 'input' and is enabled.

It is mandatory that sendKeys() works only when the textbox is enabled. So please make sure that the input element is visible.


If not then we need to go for other third party tools which interacts with the OS controls.


http://www.seleniumeasy.com/selenium-tutorials/uploading-file-with-sendkeys-method
Sponsored content

sendkeys is not working for file upload Empty Re: sendkeys is not working for file upload

Back to top
Permissions in this forum:
You cannot reply to topics in this forum