Search
 
 

Display results as :
 


Rechercher Advanced Search

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Not able to click on a Browse Button while uploading a file????

View previous topic View next topic Go down

Not able to click on a Browse Button while uploading a file????

Post by Amit Chhikara on Wed Jan 18, 2012 7:18 pm

I am nt able to click on the browse button on a web page while uploading a file using selenium....

Could anyone will help me.....

Thnaks in advance !!!!!

Amit Chhikara
Active particpant
Active particpant

Posts : 10
Join date : 2012-01-03

Back to top Go down

Re: Not able to click on a Browse Button while uploading a file????

Post by faramka on Thu Jan 19, 2012 2:46 pm

May you paste some code?

Probably you have got something like this:
Code:
<i n p u t type="file" id="upload" name="upload">
So simply:
Code:
$this->click("upload");
But what do you want to do then? You are not able to handle a browse window,
unfortunately. If you want to upload a file, you should put its path into the file input:
Code:
$this->type("upload", "C:/path/to/file/you/want/to/upload");

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Not able to click on a Browse Button while uploading a file????

Post by Amit Chhikara on Thu Jan 19, 2012 3:07 pm

faramka wrote:May you paste some code?

Probably you have got something like this:
Code:
<i n p u t type="file" id="upload" name="upload">
So simply:
Code:
$this->click("upload");
But what do you want to do then? You are not able to handle a browse window,
unfortunately. If you want to upload a file, you should put its path into the file input:
Code:
$this->type("upload", "C:/path/to/file/you/want/to/upload");


Code:
$this->type("upload", "C:/path/to/file/you/want/to/upload");

this code is working for me it is typing the address in to browse textbox button......but its not submitting the form and file is not uploading.....how to upload the file.

Please help me in the above regards....

Thnaks for reply....


Amit Chhikara
Active particpant
Active particpant

Posts : 10
Join date : 2012-01-03

Back to top Go down

Re: Not able to click on a Browse Button while uploading a file????

Post by faramka on Thu Jan 19, 2012 4:13 pm

Browse button just opens the browse dialog (where you can explore disks and find file to choose).
You must click submit button to submit form and then the file will be uploaded successfully.

If you want resolve this issue, please paste some code of your form. It will really help me to give your some clues.

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Not able to click on a Browse Button while uploading a file????

Post by Amit Chhikara on Thu Jan 19, 2012 5:06 pm

faramka wrote:Browse button just opens the browse dialog (where you can explore disks and find file to choose).
You must click submit button to submit form and then the file will be uploaded successfully.

If you want resolve this issue, please paste some code of your form. It will really help me to give your some clues.

Code:

  selenium.open("http://www.naukri.com");
      selenium.waitForPageToLoad("30000");
       selenium.type("id=username", "amit.chhikara@gmail.com");
      selenium.type("id=password", "011908101");
      selenium.click("name=Login");
      selenium.waitForPageToLoad("30000");
       selenium.click("id=preview");
      selenium.waitForPageToLoad("30000");
       selenium.click("//div[@id='content']/div/div[9]/div[2]/div[3]/table/tbody/tr/td/a[3]/u");
      selenium.waitForPageToLoad("30000");
      
      //String[] commands1 = new String[]{};
      //commands1 = new String[]{"C:\\workspace_AMIT\\ProfileUpload\\bowsebutton.exe"}; //location of the autoit executable
       http://Runtime.getRuntime().exec(commands1);
      //  String[] commands = new String[]{};
       
       //    commands = new String[]{"C:\\workspace_AMIT\\ProfileUpload\\FileUpload.exe"}; //location of the autoit executable
   
         //  Runtime.getRuntime().exec(commands);
   
       selenium.type("browsecv","E:\\My Profiles\\Selenium CV\\Testing Selenium");
      //selenium.click("//*[@id='browsecv']");
      //Here we need to call Autoit Script
      Thread.sleep(2000);
      //submit[@id='submit']
      //selenium.submit("id=submit" );
      selenium.click("//*[@id='submit']");
      

Amit Chhikara
Active particpant
Active particpant

Posts : 10
Join date : 2012-01-03

Back to top Go down

Re: Not able to click on a Browse Button while uploading a file????

Post by faramka on Thu Jan 19, 2012 5:16 pm

OK, I see you have got submitting command now.
But submitting is running a while, so you should use also waitForPageToLoad() after this line:
Code:
selenium.click("//*[@id='submit']");
or just
Code:
selenium.click("submit");

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Not able to click on a Browse Button while uploading a file????

Post by Sponsored content Today at 6:32 pm


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