So I'm wondering if there is a way to log onto a site automatically using a batch file, so i can just click on the file and it will open the browser, site and just log me on, without having to manually log on. For example if i wanted to automatically log on to my Bing.com account, i could just click on the batch file and it would open the browser and log me on. I have no clue where to start on trying to figure this out so i could really use some help.
There could be an indirect way in Google Chrome:
Find the login page of the website where you put your login and password.
Try to get the id or html tag of the login and password elements of the page.
Create a chrome extension file or simply a sample.user.js file to run some Javascript commands on the page.
Here is a sample to put your credentials in the fields of the page:
document.getElementById('login').value="*[login]*"
document.getElementById('password').value="*[password]*"
document.getElementsByTagName('input')[3].click()
In the manifest of extension file or in the #include of user.js file, define the login page of website to let the extension work just in that page.
Install the extension, here is a help how to install chrome extension manually
Now you can run chrome from terminal or .batch file to open the login page in chrome browser. take a look at how to open chrome from command line
Done!
There is a way that works in IE :
write a .vbs script to login to your website, like this link
execute your vbs script from command line or .bat file, look at this
Related
I have made a web based application in react js. I need to RUN this application by using browser extension.
I have make a build and uploaded files under account extensions add-on. manifest.json file looks like OK and validated
I am getting below error:
Firefox: Access to the file was denied. The file at moz-extension://27a7491c-7148-46cb-92be-8bf49da869b5/ReferralHistory is not readable. It may have been removed, moved, or file permissions may be preventing access.
Chrome: It may have been moved, edited, or deleted ERR_FILE_NOT_FOUND
Please help and Thanks
This is what I implemented:
downloadFile=(file)=>{
var element=document.createElement('a');
element.style.display= "none";
element.setAttribute('href', file.fileUrl)
element.setAttribute("target", "_blank");
document.body.appendChild(element)
element.click()
document.body.removeChild(element)
}
This is working fine for .ai files but not for .pdf or .jpeg. Instead of downloading the file, the browser opens it in a separate window. I want to enable download file feature and not open file. How do I fix this issue? Is there an alternative way to download the file from url from browser?
Try to use download attribute instead of href.
See element a DOC.
I'm learning Dash and I'm trying to set up a small batch file to launch the app.
I'm using as an example the first app on this plotly page. The app is very simple, and I included the code in a file called smallapp.py.
I use Anaconda as Python distribution, so I wrote a batch file called launch_smallapp.bat like this:
call C:\Users\Roberto\Anaconda3\Scripts\activate.bat
python C:\rob\Python\battest\smallapp.py
If I open a Command Prompt and type launch_smallapp.bat, the app starts correctly and I can visualise it at the url http://127.0.0.1:8050/
However, if I double-click the file launch_smallapp.bat the app doesn't work.
The Command Prompt shows the normal messages of the app being started, but if I visit the url the browser just says that the site can't be reached.
The other thing is, the Command Prompt appears with a green frame.
Does anybody have any idea?
Thanks.
my react app is working locally but after the deploy, I faced the problem when I press any button there is no problem but if I want to refresh I see that problem "404 - File or directory not found."
I found this solution:
https://github.com/ReactTraining/react-router/blob/v3/docs/guides/Histories.md#browserhistory
Configure Your Server
"Your server must be ready to handle real URLs. When the app first loads at / it will probably work, but as the user navigates around and then hits refresh at /accounts/23 your web server will get a request to /accounts/23. You will need it to handle that URL and include your JavaScript application in the response."
But I don't know how can I do this
I try something but it doesn't work
TRY
npm run build, this will create build folder inside your project root folder
if you want to deploy to remote server just transfer that build
folder.
npx serve -s build on windows, if you are using mac kindly see if it is still npx.
then try to refresh every path of it
hope this works, happy coding.
Since the server cannot find the static content in the directory (i.e. not found the file /tomcat/accounts/23), it will give you 404 unless you have additional route handling.
In React routing I think you can try with HashRouter
See more details here:
https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/api/HashRouter.md
HashRouter vs BrowserRouter
I have below autoIT script to upload file in firefox. It works fine when I run autoit script manually. But it does not work when I use it in my automation selenum script.
Autoit Script
$title = WinGetTitle("File Upload") ; retrives whole window title
WinWait("[CLASS:#32770]")``
WinActive($title)
WinActivate($title)
WinWaitActive($title)
Sleep(700)
send("!n")
Sleep(800)
Send("F:\Projects\MergeServerProject\File\OfflineAgreemntDocuments\DOC\File-1.docx")
Sleep(800)
Send("!o")
Selenium Script
clickBrowserBtn(); //This function click on browse button in file upload control on FF
String[]templatenamenew=new String[] {"F:\\Projects\\f1\\scripts\\AutoIt\\FileUpload.exe"};
Runtime.getRuntime().exec(templatenamenew);
HTML File Upload Control
Note:
I also try with sendkey function but it does not work
I noticed this wasn't answered but this should work in C# (not sure about Java, but you didn't specify the language). This line comes after your selenium script has clicked the button/field that opens the window.
Process.Start(#"C:\<source>\upload_something.exe", #"C:\<source>\myfile.jpg");
Hope it helps!