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
Amit Chhikara
Active particpant
Active particpant
Posts : 10
Join date : 2012-01-03

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

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 !!!!!
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

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

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");
avatar
Amit Chhikara
Active particpant
Active particpant
Posts : 10
Join date : 2012-01-03

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

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....

avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

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

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.
avatar
Amit Chhikara
Active particpant
Active particpant
Posts : 10
Join date : 2012-01-03

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

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']");
      
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

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

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");
Sponsored content

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

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