Creating a testing script which 'skips' file uploads - javascript

I am creating a testing script for my team. So far it works fine - it goes to the login form and attempts to login using the details you entered, if that fails it goes to a job description and attempts to apply for a job, selecting a random answer for each screening question until it gets to the actual application form. Unfortunately the application form includes a file upload control, which I don't appear to be able to skip over. Does anyone have any idea if I could actually skip over it or somehow click it? I am using FF7 and from previous posts I can see that apparently FF4 does it - but FF7 doesn't appear to make file uploads clickable through JS.... any ideas? Thanks in advance.
Regards,
Richard

Javascript can't access file upload inputs for security reasons (e.g. prevent malicious upload of user's files). For this kind of testing you should use a browser automation tool like Selenium http://seleniumhq.org/ (or in web service form https://saucelabs.com/).

Related

How to do a server redirect of URL to a different URL if the traffic is accessing from static QR code

I've always found this forum helpful. So I'm faced with a big dilemma here and was hoping someone here could help :D
HERE'S THE SITUATION:
We have multiple static QR codes that were printed on thousands of boxes which have already been distributed that go to the wrong URL. Unfortunately the designer didn't make the QR code dynamic, so we don't have the option of editing the URL through the QR code generator's interface.
We are a white label manufacturer and provide packaging to tons of clients, so what happened was a batch of qr codes got put on the wrong brand's packaging and so as you could imagine its a huge mess. Hoping someone could help ya girl out! :D
I've decided that our best bet would be to implement automatic redirects of the individual pages on the server side. My question is, is there any type of script that would be able to redirect traffic ONLY coming from a QR Code scan?? I've heard of Bootstrap being able to route traffic based on device and browser, etc. So I'm remaining hopeful that someone has heard of a way of doing this. And if there is such magical code, what file or table to I need to edit? Btw I have phpmyadmin but no cPanel.
Thank you SO MUCH in advance!
Side Note -
NO CPANEL! I'm using Wordpress 6.1 on wordpress managed hosting through GoDaddy - and so I do not have access to a cPanel unfortunately :(
I tried going through the QR code generator's interface to "edit" the URL of the QR Code, however the QR code was not created as dynamic. It is a static QR Code.
And lastly, the reason why we can't just simply sticker over the wrong QR code with a new one is because the boxes were already distributed.
Danii
It depends on what URL it goes to. If it goes to your site's domain, e.g. it shows a 404 page of your site or another page, then it is easy to fix. There are plugins for redirection and the most downloaded one and free is Redirection.
Install the plugin
Go to the plugin's settings page
Open the tab "Redirects"
Add a new redirect at the bottom of the page
see the screenshot

How can i code Zapier to follow a link that was provided in an email?

I am using Mailparser to scrape a booking email, then use Zapier to create a booking in our system.
In the email is a link to confirm the booking so am wanting to use the code action to click on the link or follow the link.
Nothing needs to be seen, just follow the link & allow the page to load. This confirms the reservation
I have attempted using python & JS to no avail.
Can you point me in the right direction?
Thanks for reading!
David here, from the Zapier Platform team.
When you click on a link and it opens in your browser, all that really is is a GET request. If the site you're trying to load is simple, then this can be accomplished with a Webhook by Zapier step that make the request to the provided URL.
The big issue that'll pop up is if the site is more complex. A browser loads and execute all the javascript on the page, which our GET request won't do. If the site uses javascript to confirm the reservation (not just the page loading itself), then this isn't going to work. If that's the case, it's a lot more involved. You'd probably need to make a CLI app and use a tool like PhantomJS that can load pages and everything in them. Note that I haven't tested that on the CLI and there's a chance it's incompatible with the way we run apps, so do a proof of concept before you really dive in.
Hope this helps. ​Let me know if you've got any other questions!

liveCycle force close document

I was tasked to create a function to "protect" document with a password.
I figured and the previous forms create a dialog asking for a password then validate it with the value in an hidden field on the form if they are not the same close the pdf file, I know this is not the most secure way to protect but the user is well aware of it and is fine with it "unless i can find a way to to automate the securing of the file.
My issue now is that i can't seems to be able to execute javascript code that would close the form "in liveCycle" because of security restriction implemented by adobe from what i understand.
I know that with acrobat pro i can use he command this.closeDoc(); to do this but everything i tried with live cycle (different version of app.execMenuItem("close"); &
event.target.closeDoc(true); ) has failed to work. Any idea how i could force the security to allow one of those two command or to use another command to close the document programmatically?
Thanks
Try using this -
app.setTimeOut('this.closeDoc(true);', 1);
It worked for me for one of my requirements in the button 'click' event.

Open local html file in current window with Javascript Bookmarklet

I'm trying to build a sample bookmarklet to grab current webpage source code and pass it to a validator. Validator is not a an online website, but a folder with bunch of javascript and html files. I'm trying to open file:///C:/Users/Electrifyings/Desktop/Validator/Main.html file with the help of javascript bookmarklet code and put the source code in the textarea in the newly opened window, but it is not working for some reasons that I'm not aware of.
Here is the sample code with algorithm:
javascript:(function(){var t = document.body.innerHTML;window.open('file:///C:/Users/RandomHero/Desktop/test.html',_self);document.getElementById("validator_textarea")=t;})()
Here are the steps:
Grab current web page source code in a variable.
Open locally stored HTML web page in current or new window or new tab (either way is fine with me, but no luck)
Put the source code from the variable into the validator textarea of the newly opened HTML file.
I have tried above code with a lot of variations, but got stuck on the part where it opens the new window. Either it's not opening the new window at all or it is opening blank window without loading the file.
Would love to get some help with this issue, thanks a lot.
Oh and btw,
Windows 7 x64, Tried IE, Firefox and Chrome. All latest and stable builds. I guess it's not a browser side issues, but something related to javascript code not opening the URI with file:/// protocol. Let me know if any more details are needed. :)
You wouldn't want a webpage you visit to be able to open up file://c:/Program Files/Quicken/YourSensitiveTaxInfo right? Because then if you make a mistake and go to a "bad" website (either a sleazy one or a good one that's been compromised by hackers), evil people on the intarweb would suddenly have access to your private info. That would suck.
Browser makers know this, and for that reason they put VERY strict limits to prevent Javascript code from accessing files on a user's local computer. This is what is getting in the way of your plan.
Solutions?
build the whole validator in to the bookmarklet (not likely to work unless it's really small)
put your validator code up on the web somewhere
write a plug-in (because the user has to choose to install a plug-in, they get much more freedom than webpages ... even though for Firefox, Chrome, etc. plug-ins are basically just Javascript)
* * Edit * *
Extra bonus solution, if you don't limit yourself to a purely-client-side implementation:
Have your bookmarklet add a normal (HTML) form to the page.
Also add an iframe to the page (it's ok if you hide it with CSS styling)
Set the form's target attribute to point to the iframe. This will make it so that, when the user submits the form and the server replies back to that submission, the server's reply will go to the (hidden) iframe, instead of replacing the page as it normally would.
Add a file input to your form - you won't be able to access the file within that input using Javascript, but that's ok because your server will be doing the accessing, not your bookmarklet.
Write a server-side script which takes the form submissions, reads the file that came with it, and then parrots that file back as the response. In other words, you'll have a URL that you can POST to, and when it sees a file in the POST's contents, it will respond back with the contents of that file.
Now that you've got all that the user can pick their validator file using the file input, upload it to your server, your server will respond back with the file it just got, and that file will appear as the contents of the iframe.
And now that you finally have the file that you worked so hard to get (inside your iframe) you can do $('#thatIframe').html() and viola, you have access to your file. You can save the current page's source and then replace the whole page with that uploaded file (and then pass the saved page source back to the new validator page), or you can do whatever else you want with the contents of the uploaded validator file.
Of course, if the file doesn't vary from computer to computer, you can make all of that much simpler by just having a server that sends the validator file back; this could be a pure Apache server with no logic whatsoever, as all it would have to do is serve a static file.
Either way though, if you go with this approach and your new file upload script is not on the same server as your starting webpage, you will have a new security problem: cross-domain script limitations. However, these limitations are much less strict than local file access ones, so there are ways to work around them (JSONP, cross-site policy files, etc.). There are already tons of great Stack Overflow posts explaining these techniques, so I won't bother repeating them here.
Hope that helps.

Creating an auto-login script to website?

We have an intra-net website that requires me to enter login information every time and it's annoying.
I want to create some sort of automatic login for this website.
I tried creating a two-frame website, with one page being the login page and the other being my own html. In my html, I wanted to enter values to the textboxes in the other frame but got an "access denied" js error.
Any other idea?
(I know I can record a Macro, but unfortunately, can't install any third-party applications in the inner-network. I could also have used Robo-Form...).
Oh yeah, and it has to work on the worst browser ever, Internet Explorer 6...
Maybe local html file with form that mimic login form and with autosubmit (like onload="form1.submit();"?). Than you can run this file and it will autosubmitted and redirects you where you want to go (form's action).
A greasemonkey script might work.

Categories

Resources