Can someone please help me in automating file upload on this page-
https://www.designerexchange.com/index.php/sell/quote
I tried everything, but the file upload is very dynamic.
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.
Sign up to join this communityCan someone please help me in automating file upload on this page-
https://www.designerexchange.com/index.php/sell/quote
I tried everything, but the file upload is very dynamic.
It seems like you should be able to do this using selenium to fill out the form, click on "upload files" and then click on "drop files here to upload". Then you have the issue of interacting with the OS. You should be able to find some tutorials for that. See https://stackoverflow.com/questions/10322501/how-do-i-interact-with-windows-programs for example.
ok. I was able to solve this issue using AutoIT with Selenium. Using webdriver, I clicked on Upload File link and opened the Windows File Browsers(to select the image), then I ran the AutoIT script using Java Runtime to enter the file path and click on Select button. And it worked. Thankyou all. Closing this question...
I don't know if I understand your problem right but I think the problem is in interacting with OS (the browser window) and to solve this it will be better to use sikuli as it deals with the elements displayed on the screen by providing images
I just gave XLT a try. It records the stuff in Firefox and you can replay it later in FF again, also as batch test. Works fine, does not need any other tool. Also got it working with the FirefoxDriver and ChromeDriver without any additional tools.
The trick is to make the file input element visible (line 13) and the type command will be accepted and executed happily by the Webdriver and the file will be uploaded. If you want, you can restore the original state of the element later again.
Disclaimer: I am affiliated with the tool XLT.
The raw XLT Script Developer file.
<?xml version="1.0" encoding="UTF-8"?>
<testcase xmlns="http://xlt.xceptance.com/xlt-script/2" version="6" baseURL="https://www.designerexchange.com">
<action name="OpenStartPage"/>
<command name="open" value="https://www.designerexchange.com/index.php/sell/quote"/>
<action name="TUpload-0"/>
<command name="type" target="id=Quote_uName" value="Test"/>
<command name="type" target="id=Quote_email" value="mail@test.de"/>
<command name="select" target="id=Quote_item_id" value="label=Alexander McQueen"/>
<command name="type" target="id=Quote_item_name" value="Foo"/>
<command name="type" target="id=Quote_item_desc" value="Bar"/>
<command name="click" target="id=uploadmorelnk"/>
<codecomment>Make sure the modal dialog is open</codecomment>
<command name="waitForVisible" target="//*[@id='quoteImgFrmId']//span[contains(@class,'heading')]"/>
<codecomment>Make the element visible, so the Webdriver can type</codecomment>
<command name="storeEval" target="$('.dz-hidden-input').attr('style', '')" value="test"/>
<codecomment>Set the file location</codecomment>
<command name="type" target="//input[@type='file']" value="/home/rschwietzke/tmp/new-logo-acceptance.png"/>
<codecomment>Click the upload</codecomment>
<command name="click" target="id=dzuploadbttn"/>
<codecomment>Make sure the file is uploaded</codecomment>
<command name="waitForText" target="//form[@id='quoteImgFrmId']" value="*(100%)*"/>
<command name="click" target="id=canceluploadbttn"/>
</testcase>
Tool description: XLT is freely available with no license cost for regression testing. No registration required, not support contract, nothing, just download and go. It extends the Selenium concepts by supporting reusable modules, test data, and features test documentation that can be automatically generated.
I am afraid, as far as I know, it is not possible to handle file-uploads with selenium due to security issues.
I encountered this issue myself and searched the web for a solution but did not find anything except that it is not possible.
Regards,
Markus.