Upload file using Jenkins Active Choices Reactive References plugin - jenkins

I am using Jenkins Active Choice plugin. I want to provide a file upload function based on reference variable
The below setting allows me to enter text when i select reference parameter scan_type as vulnerability-Web
What i want is , instead of taking text input it should upload file , and content of the file should be assigned to SELENIUM_RECORDED_FILE
I tried using below groovy
if (scan_type.equals("Vulnerability-Web")) {
inputBox = "<body> <form action='upload.php' method='post' enctype='multipart/form-data'> Select file to upload: <input type='file' name='fileToUpload' id='fileToUpload'> </form>"
return inputBox
}
its adding file upload option but the file content is not stored in SELENIUM_RECORDED_FILE
Please let me know how can we achieve this

Reading through HERE, it looks like you must have
<input type="file" name="file">

Related

Front end base64/blob asset upload via form submission in CraftCMS3

Goal
I only have baes64/blob data available from a <canvas /> and want to upload the image via from submission in front-end.
Methods I've tried
I've read about Uploading Files from Front-End Entry Forms in doc.
CraftCMS ONLY supports <input type="file">. The file type input does not support accepting re-assign value like other input tags directly.
Assets fields do actually support submitting Base64-encoded data; it just wasn’t documented. Done now though!
The file type input now support reassign value.
Steps:
convert your blob into file obj
Update your Filelist in js.
Updated Filelist replace with your input files.
let file = new File([blob], fileName);
let list = new DataTransfer();
list.items.add(file);
$(input)[0].files = myFileList;
Here is original thread

NodeMCU enduser setup module html file that creates another file

I have created my own enduser_setup.html file nodemcu(for the enduser setup module: https://nodemcu.readthedocs.io/en/master/en/modules/enduser-setup/#enduser_setupstart).
I have added another field (beyond the ssid\password fileds):
<input id=result1 type=text autocorrect=off autocapitalize=none placeholder='Place ID' />
I want on submit to create a lua file (result1.lua) with the Get result of this field.
Tried with php:
<?php
$myfile = fopen("result1.lua", "w") or die("Unable to open file!");
$txt = $_GET["result1"];
fwrite($myfile, $txt);
fclose($myfile);
?>
Did not work :(
That is currently not possible with NodeMCU. However, there is a pending pull request that'll add this feature. It's likely going to be merged to the dev branch in the next days.

Image upload functional testing in Geb

When i am testing the image upload in Geb ,how i click the Open option when we
have to select image from the system My code is:
class UploadImageTestSpec extends GebReportingSpec{
def "test for UploadImage"()
{
when:
to LandingPage
waitFor(20) {title.endsWith("Jobulo")}
loginButton.click()
j_username="candidate2"
j_password="p"
login.click()
then:
at DashBoardPage
when:
at DashBoardPage
waitFor(20) {title.endsWith("Jobulo")}
uploadImage.click()
// uploadImage1.click()
Thread.sleep(1000)
//new File(".").getAbsolutePath().replace("..","");
// cd=new File(".").getAbsolutePath().replace("..",""); + "images.jpeg"
driver.manage().timeouts().implicitlyWait(200,TimeUnit.SECONDS)
crop.click();
then:
at DropDownPage
}
}
It is not possible to do image upload using geb.
Refer this link: http://www.gebish.org/manual/current/#file-upload
It’s currently not possible with WebDriver to simulate the process of a user clicking on a file upload control and choosing a file to upload via the normal file chooser. However, you can directly set the value of the upload control to the absolute path of a file on the system where the driver is running and on form submission that file will be uploaded.
<input type="file" name="csvFile">
$("form").csvFile = "/path/to/my/file.csv"
-- From the link

Get value of an input element on a firefox addon

How i can fetch the value of this input element in my main.js:
<input type="hidden" value="12124054" id="ctl00_cphContent_hdnID" name="ctl00$cphContent$hdnID">
I tried var id = document.getElementById("ctl00_cphContent_hdnPlayerID").value; and contentWindow.document.getElementById("ctl00_cphContent_hdnPlayerID").focus(); but i am getting errors that document and contentWindows are unidentified :(
You need to get the value from the page using a content script and then send the value to main.js - this is because web content is inherently untrusted by the addon-sdk. Please see these docs for more on how to use content scripts:
https://addons.mozilla.org/en-US/developers/docs/sdk/1.0/dev-guide/addon-development/web-content.html#content_script_events
Here is an example add-on on Builder that shows how to pass values frmo the content script back to main.js. In this case I'm using the xui library to more easily bind events in the pgae.

struts2 image button cannot calculate source of image

I need embed image button to page under Struts2.
Unfortunately absolute path cannot be used, so I need application-related url, but <s:submit type="image" src="i/go_btn.gif" doesn't work and expected url: app/i/go_btn.gif is not resolved. On other hand <s:url cannot be used because of error: "src does not accept any expressions"
So question: how to specify url of image in s:submit tag in application relative format?
use a root relative path perhaps.
placing "/" before the url means the root of the app. See http://www.coderanch.com/how-to/java/RelativeLinks
I've found my own solution. It is appeared that template for submit control (submit.ftl) contains following line for src attribute:
<#if parameters.src??>
src="${parameters.src?html}"<#rt/>
</#if>
That is why code for <input type="image" always generated with specified URL. It have to be changed as follow:
<#if parameters.src??>
src='<#s.url value="${parameters.src?html}" includeParams="none" />'<#rt/>
</#if>

Resources