Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

» Selecting the input for auto populating element
Sat Jul 29, 2017 7:53 pm by kdabbara

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

sendkeys is not working for file upload

View previous topic View next topic Go down

sendkeys is not working for file upload

Post by jeevitha on 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.

jeevitha

Posts : 1
Join date : 2014-06-27

Back to top Go down

Re: sendkeys is not working for file upload

Post by mail2prassad on 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.

mail2prassad
Amateur
Amateur

Posts : 41
Join date : 2013-06-05

Back to top Go down

Re: sendkeys is not working for file upload

Post by nabhanya.varma on 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

nabhanya.varma
Active particpant
Active particpant

Posts : 13
Join date : 2014-03-02

Back to top Go down

Re: sendkeys is not working for file upload

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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