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
Krishnaveni
Posts : 2
Join date : 2011-06-27

File Upload using Webdriver Empty File Upload using Webdriver

Mon Jun 27, 2011 1:36 pm
Hi,

Can anybody tell me how to upload file using webdriver. in my application, i need to click on 'Add' button which will open window, where i need to give file tile, tile description and file path(i.e from clicking on browse button and selecting file). after selecting file, the button 'Confirm' will be enabled. i have given the following code for fileupload. but the button 'confirm' is not enabled. please suggest me how to do.

please see the below code which i have written :
driver.findElement(By.xpath("//img[@alt='add']")).click();
driver.findElement(By.id(
"fileTitle")).sendKeys("Title...");
driver.findElement(By.id(
"fileDescription")).sendKeys("Description...");
driver.findElement(By.id(
"file")).sendKeys("C:\\Program Files\\Microsoft Office Communicator\\eula.rtf");

driver.findElement(By.xpath(
"//img[@alt='submit']"));

Thanks &Regards,
Krishnaveni
avatar
Krishnaveni
Posts : 2
Join date : 2011-06-27

File Upload using Webdriver Empty Re: File Upload using Webdriver

Mon Jun 27, 2011 5:04 pm
Message reputation : 100% (1 vote)
Use the below code for file upload using webdriver :

WebDriver
[size=9]driver
;
EbayPageObject [size=9]ebayPageObject;[/size]

driver
=new FirefoxDriver();
[size=9]
ebayPageObject
= new EbayPageObject("http://10.239.53.68:8080/pp", driver);
File imagedefect4 =
[size=9]new
File("C:\\Program files\\Defect-Attachments\\Defect4.JPG");[size=9]
ebayPageObject
.typeInputtext(By.id("file"), imagedefect4.getAbsolutePath());[size=9]
ebayPageObject
.clickOnButton(By.xpath("//a[@href='javascript:uploadClientFile();']"));

[/size][/size][/size][/size][/size]
avatar
Love Sharma
Regular Participant
Regular Participant
Posts : 27
Join date : 2012-06-01

File Upload using Webdriver Empty Re: File Upload using Webdriver

Fri Jun 01, 2012 6:54 pm
Thanks for this post Krishna. Can you please advise why you have used [size =9] or[/size] in your code. I am finding hard to understand this.
Sponsored content

File Upload using Webdriver Empty Re: File Upload using Webdriver

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