Unable to Upload the File using Watir - ruby

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.

Related

unable to upload image using cypress?

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
}

Laravel image doesn't display

I'am using this code to display the image
#foreach($Phones as $clothe)
#if($clothe->category=='Phones')
<div class="card" style="width: 300px; display:inline-block; margin:20px;">
<img class="card-img-top" src="{{ URL::asset('storage/images/'.$clothe->image)}} " width="100%"/>
the picture exist on storage\app\public\images but it doesn't display on my page, btw i've made the php artisan storage:link
For those who are having the same problem as me here is what to do :
delete the folder storage on public and retype the command "php artisan storage:link"
add src="/ and give it a try
check image available in folder ProjectName/public/storage/images/a30_1606210965.jpg
read this artical/link...
https://www.itsolutionstuff.com/post/how-to-display-image-from-storage-folder-in-laravelexample.html
from above article
<img src="{{ asset('/images/'.$clothe->image) }}" alt="" title="">
Following code is working fine on my side.
.env
FILESYSTEM_DRIVER=public
Php artisan config:clear
Upload image code
$request->file('image')->store('image');
blade file
<img src="{{ asset('storage/'.$clothe->image) }}" alt="" title="">

deploy spring boot application on tomcat, should I replace all my app's urls

I arrived to deploy my spring boot application on tomcat, I followed this site https://www.mkyong.com/spring-boot/spring-boot-deploy-war-file-to-tomcat/
But I did changes to my html files:
my application name is : GestionRetardApp its version is '0.0.1'
before making changes in my html files, I have this file as example:
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="layout/layout">
<head>
<meta charset="UTF-8" />
</head>
<body>
<div layout:fragment="content">
<center>
<form action="/searchByName">
<table>
<tr>
<td><select name="nomprenom" class="form-control">
<th:block th:each="p : ${rhEmployeesList}">
<option th:text="${p.nomPrenom}" th:value="${p.nomPrenom}"></option>
</th:block>
</select></td>
</tr>
</table>
<input type="submit" value="Rechercher">
</form>
</center>
</div>
</body>
</html>
I find my self forced to change <form action="/searchByName"> to
<form action="/GestionRetardApp-0.0.1/searchByName">
I did that for all the urls that I have!
Is there another way to keep my default code and don't make changes to my html files?
There are several ways to do it.....
1. use <base href="${pageContext.request.contextPath}/" />
Use a global javascript variable and append it with all network calls
pass the baseUrl as parameter to template. Then: <a th:href="${baseUrl + '/my/uri?maybe=' + someParam}".
Hope that helps.
You can make your application as default in tomcat.
Steps:
delete the ROOT directory
name your war file "ROOT.war" (capitals mandatory)
drop the ROOT.war file directly in the /webapps directory.
There are other ways, too please read How do I make my web application be the Tomcat default application?

How do I automate file upload in cucumber with Ruby if the upload file is a button tag

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>

jquery file upload Error Not Found

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 .

Resources