Comments (10)
I optimize and refine the syntax of my code. Here's the updated version and it works on windows. @marcelocecin thanks so much
js begin
function send_attachment_url() {
var fs = require('fs'); // Import the file system module
var dataFilePath = 'D:\rpa\rpademo\xinniuren\历史.txt';
if (!fs.exists(dataFilePath)) {
casper.echo('File does not exist: ' + dataFilePath).exit();
}
if (!fs.isFile(dataFilePath)) {
casper.echo('Path is not a file: ' + dataFilePath).exit();
}
if (!fs.isReadable(dataFilePath)) {
casper.echo('File is not readable: ' + dataFilePath).exit();
}
var curlPath = 'D:/curl-8.7.1_7-win64-mingw/curl-8.7.1_7-win64-mingw/bin/curl.exe';
casper.start().waitForExec(curlPath, ["-X", "POST", "-F", "file=@" + dataFilePath.replace(/\/g, '/'), "http://localhost:8080/File/"], function(response) {
this.echo(JSON.stringify(response.data));
}, function() {
this.echo('Command timed out');
}, 20000);
casper.run(function() {
this.exit();
});
}
send_attachment_url();
js finish
from tagui.
error:
{"timestamp":"2024-04-26T01:25:49.657+0000","status":500,"error":"Internal Server Error","message":"Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found","path":"/File/"}
from tagui.
and i have another question
if i use python script to send a Chinese path file to Remote machine in tagui script , that is not ok.
from tagui.
try to use run
command with curl
Runs a command in Command Prompt or Terminal and saves the stdout to the variable run_result
.
run [shell command]
Examples
run cmd /c mkdir new_directory
from tagui.
@marcelocecin hello
i use curl command on windows by tagui script as follows:
run cmd /c D:\curl-8.7.1_7-win64-mingw\curl-8.7.1_7-win64-mingw\bin\curl.exe -X POST -F "file=@d:\rpa\rpademo\tuijian\1714300843597.txt" http://localhost:8080/File/
echo run_result
errors:
The filename, directory name, or volume label syntax is incorrect.
but I use curl -X POST -F "file=@d:\rpa\rpademo\tuijian\1714300843597.txt" http://localhost:8080/File/ on cmd command ,that is ok. but using tagui ,error is The filename, directory name, or volume label syntax is incorrect. why?
from tagui.
how to debug tagui source code?
from tagui.
try using command arguments with single quotes
from tagui.
@marcelocecin using single quotes is not ok . it is too hard to use.
from tagui.
so try to create tagui_local.js
example:
function send_attachment_url(msg,file,url) {
casper.options.waitTimeout = (30*1000);
casper.waitForExec('curl -F msg="'+msg+'" -F upload=@'+file+' '+url, null, function(response) {
run_result = '';
run_result = (response.data.stdout.trim() || response.data.stderr.trim()); run_result = run_result.replace(/\r\n/g,'\n');
run_json = response.data;
this.exit();},
function() {this.echo('ERROR - command to run exceeded '+(casper.options.waitTimeout/1000).toFixed(1)+'s timeout').exit();});
}
then in your script.tag
https://google.com
wait 5
js send_attachment_url("sd","C:\Users\Admin\AppData\Local\Postman\app-6.0.10\ffmpeg.dll","http://localhost:8080/File/")
PS: If it still doesn't work, I suggest testing sending it to an external url, for example https://webhook.site/
from tagui.
@marcelocecin thanks very much, i will try it first
from tagui.
Related Issues (20)
- No support for JS ES6 syntax
- Difference fron Cucumber.js?
- [RPA][ERROR] - TagUI process ended unexpectedly - ERROR - undefined is not an object (evaluating 'e.message.charAt') HOT 1
- run next code giving fault: F:\tagui\src>tagui f:\tagui\flows\samples\1_google.tag
- Method in Tagui HOT 1
- Text not found
- Is it possible to get name of the latest downloaded file?
- Read method issue
- Is there any support for google sheets?
- Is the project no longer under maintenance
- I don't see any updates on the issues. Is this project still active?
- Can we create a method for reuse across various places? HOT 1
- 请教下,现在有个需求就是要在当前已经打开的浏览器用tagui执行流程,非临时浏览器,有啥办法或者思路去实现吗?谢谢 HOT 1
- how to use casper object in tagui script? HOT 1
- 请教下对于打开页面 不管直接是http://xxx.com 或者是popup xxx 有没有办法监听他们加载完成后再执行操作?
- Do you have support for google sheets?
- difference between present() and exist()?
- what is the default auto-captioning models directory on windows?
- How to open a list of url from csv
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tagui.