Using this code:
const imagefile='aboutfirst.png';
cy.get('[name="File"]').attachFile(imagefile);
or
const imagefile='aboutfirst.png';
cy.get('#File').attachFile(imagefile);
I already installed the upload file path using terminal and the picture is in fixtures.
This is the HTML where I request the name:
<input id="File" name="File" type="file" />
And the response I get from cypress in both cases:
Timed out retrying after 4000ms: Expected to find element: [name="File"], but never found it.
The selector cy.get('[name="File"]') should find the <input id="File" name="File" type="file" /> element, except if there's a shadow DOM involved.
Dev tools will show you the shadow root when you inspect the element.
If so, add this line to your cypress.json config file
{
includeShadowDom: true
}
Related
I am trying to render an illustration with the following path /public/illustrations/free_mode.jpg, but for some reason when I navigate to the page where the image is supposed to be rendered the image is not found and yarn dev command exit with code 137. When I checked .next folder I've found all the other images in the cache except for the one causing the error. My code is the following:
<Image
src="/illustrations/free_mode.jpg"
alt="illustration"
width={300} height={300}
className="w-full h-9 md:h-auto md:w-48 md:rounded-none md:rounded-l-lg"
/>
It worked well for other images but when I added this one it doesn't the app server crashed.
To use a local image, import your .jpg, .png, or .webp files:
import freeMode from './illustrations/free_mode.jpg'
<Image
src={freeMode}
alt="illustration"
width={300} height={300}
className="w-full h-9 md:h-auto md:w-48 md:rounded-none md:rounded-l-lg"
/>
I am trying to upload the file through running the automation scripts but I am unable to do so can someone help me with these
System Configurations
Windows:7
Ruby:1.8.7
The HTML code is as below
<td id="fileNameArea" colspan="2">
<br>
Set up File
<input id="file" type="file" name="file">
</td>
BROWSER.file_field.set("/path/to/file.xls") if File.exist? "/path/to/file.xls"
Do the file type check before the set method if necessary.
I develop a custom module and I need this module to show some pictures choosen in backend. So... I declare a parameter with type "imagelist" in my module xml file.
<fields name="params">
<fieldset name="advanced">
<field
name="project1-image"
type="imagelist"
directory="???\images"
label="..."
description="..." />
</fieldset>
</fields>
The problem is "images" dir located in some Joomla template. Is there maybe some constant like "JPATH_COMPONENT" or "JPATH_BASE" pointing to currently applied template to site? Or I need force site admin to write filename and find it in php file of my module, this seems like a bad solution.
Thanks in advance, Andrey!
<field name="myimage" type="imagelist" default=""
label="Select an image" description="" directory="images" exclude="" stripext="" />
directory (optional) is the filesystem path to the directory containing the image files to be listed. If omitted the directory given by JPATH_ROOT is assumed.
You can also use <field name="myimage" type="media" directory="stories" />
This will open the media manager with the directory /images/stories/ already selected.
How do I automate file upload in cucumber with ruby if the upload file is a button tag. I tried to convert the type to file with the script:
#browser.execute_script("document.getElementById('elementid').setAttribute('type', 'file');")
#browser.div(:class => "classname").file_field.set(file.path)
Then I get the error:
unable to locate element, using `{:tag_name=>"input", :type=>"file"}`
The error occurs as the tag name in my application is <button>.
How do I handle this, any suggestions?
HTML:
<button type="button" id="pickfiles" class="btn btn-default" data-ng-class="{'disabled': noRuntime}" style="position: relative; z-index: 1;"> Select file </button>
I am using jquery file upload with the Codeignitor . I copied the working code and place it in Codeignitor . When i try to upload the file i keep getting this meessage
Error Not Found
I check on internet and its says path issue where as i can access the file with that path
in codeignitor my form has this value for action
<form id="fileupload" action="<?php echo base_url()?>public/assets/jquery-file-upload/server/php/index.php" method="POST" enctype="multipart/form-data">
and in firebug i can see the full path in the action attribute .