I'm really new to Selenium. I took a look at Selenium IDE and it was very easy to use but when I tried learning Selenium WebDriver but I'm having a hard time looking for good material to learn from. The way I understand this is that I has to be used with a programming language? is this correct? if not, I would prefer to use WebDriver with PHP since I'm more familiar with it. I made some research and I found that Selenium is mostly used with PHP testing frameworks but I dont want to use it with a testing framework since I'm not doing any testing. Is there anyway to use selenium with PHP only?
That being said, I would really like to know if it is possible for selenium to a web service, me and my team plan to have this as as service in the website we are hosting.
Let's say for example, a customer request to automate a task, like to post ads on a e-commerce website using a CSV and some images. There would be some kind of form for the customer to submit their CSV file and images. And the data in the CSV would be used as materials for the ads. We make the script for this specific request, is it possible to host the script from the server and run the script from there every time the costumer want to automate the task again?
Or can the selenium only be executed from the customers computer? If so, how can the customer start the script and to open the server to get the script? What should be installed in the customers computer? A .bat file would probably one solution but I am not sure how it can access the script in the server or what files are needed to install for that matter.
I would really appreciate the help.
Thanks in advance!
No, we can not use it as you expected it for.
if you are ready to write script you can write any webservice for the same task as selenium is not for the purpose you want.
Related
I'm quite new to the Azure interface, but I have been working with PHP for a while.
I have been asked to make a routine that executes every some time at background, whose objective is to send some marketing mail.
And I have been reading about WebJobs. I can't quite get the grasp of it, though.
For me the documentation is a bit overwhelming, to say at least. So what I want to do is understand how WebJobs work and use them to execute PHP code every some time, without needing user input.
As I have said before, I have never used Azure before and have been never asked to do such things on PHP either, at least not this complex.
There is a walkthrough of how to create a webjob on the azure docs - php is supported in webjobs. Webjobs are essentially a means for App Services to run a non-interactive process on a triggered or continuous basis. You don't have to use PHP, you can run another .exe if you like. Personally I write code in c# using the webjobs SDK and deploy those, they ease the way in which triggers, inputs and outputs are passed to/from your webjob via a nice simple binding process.
Theres a more detailed explanation here. Webjobs are hosted in your app service plan, which you can look at as a container for resources used to run and host your web sites, web apis, and web jobs.
Last copuple of things to say are 1 - that via the portal you can see the status of all your webjobs, when they triggered, what the console output was, if they succeeded or failed, etc. and 2 - Azure Functions do the same thing but in a different way - they use the webjobs api but present as a "serverless" experience instead (ie. no app service required). So if you don't want to be concerned with a web site or managing the scaling yourself, see Functions documentation
Before this question gets closed, I know the setup above is possible. I just want clarification on some things.
I just started learning Aurelia because I want to convert one of my projects into a web app. My project is built with html+css+JavaScript(jQuery)+ PHP(MySql).
I havent used any sort of framework before.
In the guide, they mention a few ways to setup a web server. I used the http server with node. Now this is where I need some help understanding a few things.
I dont want to use node.js. I want to use PHP on the server. Will that work and how?
When using Apache server, I know any PHP page is sent to the interpreter that renders the final html. I use XAMPP and its apache comes bundled with PHP. Does the http server used by node come with PHP? Is this even a sensible question?
Now I know Aurelia is purely front end. If it used to make single page applications, it uses Ajax. So now I made the following assumption:
Using Aurelia, the user accesses the root page of the app that the web server sends. After that, Aurelia makes various Ajax requests to the server which will use my PHP files to do database query stuff.
Is that right or am I missing something. And can I just use xampp(apache) to host my app instead of server from node?
Aurelia is a framework that, after you export it to any server, does not rely on any back-end software at all. This means that with the help of the http- / fetch-client API, you can just call out to your php script.
I have an example in my github:
https://github.com/rjpvroegop/randyvroegop.nl-made-with-aurelia
Here I use the http-client to post data to my php script wich has a very simple email functionality.
You can see the action inside my view-model in src/pages/contact/index.js.
You can see the PHP script in src/assets/components/contactengine.php.
These work the way they should. Note: you have to change your gulp build if you want your PHP served the way I serve mine, from the dist folder after gulp-watch or gulp-export.
Next to that you can use any back-end functionality you would like, as long as it returns the proper data. This PHP script does that. If you would download my distribution to test this you can simply do the following:
gulp export from your terminal in the root folder
copy everything from the export folder to your PHP webserver.
So we've got a web app at work that we're working on migrating.
The new version is based on Zend Framework, and we're gradually moving it over from this really odd little ASP classic app written in Jscript, that comes with it's own set of terminal clients that actually need to be installed on the client machine in order to work.
The reason we need the terminal clients is because we need to click on a link in a web page, and that opens up the terminal apps which log into remote systems, sometimes over two and three steps to obtain information which is sent back to the terminal client, which they then copy and paste into another application, which is processed by a perl script, and sent to the database that the first app uses.
This process is painful.
What I want to do is use ssh programmatically, to log into a remote device, in this case a router in another city, and then use telnet from there to navigate to another app that uses a series of moderately complex telnet menus (I think this is the sticking point) to navigate to the data that's needed.
There are some extremely well rounded php programmers on stack overflow, and I thought I would post here to see if anyone had solved this kind of problem before using PHP and/or Zend Framework.
When I searched for this topic on the site, I was unable to find a solution that fit the problem.
Is there a library or set of libraries I can use to do this job?
Thanks in advance for your time and attention.
I have been researching this topic for a bit, and have not tried any of these solutions myself, but here is what I have found so far in my research:
https://github.com/graze/telnet-client
https://github.com/jnorell/Net_Telnet
https://github.com/farzadghanei/POLlib
http://www.geckotribe.com/php-telnet/
Ive built an AngularJS application over the last several months that utilizes a MySQL database for its data. This data is fetched by Angular making calls to PHP and PHP returns JSON strings etc.
The issue is once this application is running inside node-webkit, none of the php works, so all of the content areas are empty. I assume (though the documentation on this issue is null and so i have no confirmation) this happens because Node-webkit is a client-side application framework and therefor wont run server-side languages like php. Is there a way to expand node webkit to run php and other server side languages?
I have done my best to find an answer to this question before posting, but documentation for this is nonexistent, and all of the information I have found about node-webkit talks about installing node on your server and installing npms for MySQL and having angular make calls to node. This defeats the purpose of the application entirely as it is designed so that the exe/deb/rpm/dmg can run and you can set up a database with any cloud database provider and be ready to go. Not ideal if you have to buy a vps just to run this one thing.
I have to assume this is possible in some way. i refuse to believe that everyone with an nw application hard codes all their data.
Thanks in advance
I know of four methods to accomplish this. Some of which you have preferred not to do but I am going to offer them in the hopes it helps you or someone else.
Look for an NPM that can do this for you. You should be able to do this functionality within node.js. - https://www.npmjs.com/search?q=mysql
You can host your PHP remotely. Using node-remote you can give this server the appropriate access to your NW.js project.
You can code a RESTful PHP application that your JavaScript can pass off information to.
You can use my boilerplate code to run PHP within a NW.js project. It however fires up an express.js web server internally to accomplish this. But the server is restricted to the machine and does not accept outside connections - https://github.com/baconface/php-webkit
1 and 4 both carry a risk in your case. Your project can be reversed engineered to reveal the source code and the connection information can be retrieved rather easy. So this should only be in an application on trusted machines and 2 and 3 are the ideal solutions.
I'm playing with an embedded Linux device and looking for a way to get my application code to communicate with a web interface. I need to show some status information from the application on the devices web interface and also would like to have a way to inform the application of any user actions like uploaded files etc. PHP-seems to be a good way to make the interface, but the communication part is harder. I have found the following options, but not sure which would be the easiest and most convenient to use.
Sockets. Have to enable sockets for the PHP first to try this. Don't know if enabling will take much more space.
Database. Seems like an overkill solution.
Shared file. Seems like a lot of work.
Named pipes. Tried this with some success, but not sure if there will be problems with for example on simultaneous page loads. Maybe sockets are easier?
What would be the best way to go? Is there something I'm totally missing? How is this done in those numerous commercial Linux based network switches?
I recently did something very similar using sockets, and it worked really well. I had a Java application that communicates with the device, which listened on a server socket, and the PHP application was the client.
So in your case, the PHP client would initialize the connection, and then the server can reply with the status of the device.
There's plenty of tutorials on how to do client/server socket communication with most languages, so it shouldn't take too long to figure out.
What kind of device is it?
If you work with something like a shared file, how will the device be updated?
How will named pipes run into concurrency problems that sockets will avoid?
In terms of communication from the device to PHP, a file seems perfect. PHP can use something basic like file_get_contents(), the device can just write to the file. If you're worried about the moment in time the file is updated to a quick length check.
In terms of PHP informing the device of what to do, I'm also leaning towards files. Have the device watch a directory, and have the script create a file there with something like file_put_contents($path . uniqid(), $command); That way should two scripts run at the exact sime time, you simply have two files for the device to work with.
Embedded linux boxes for routing with web interface don't use PHP. They use CGI and have shell scripts deliver the web page.
For getting information from the application to the web interface, the Shared file option seems most reasonable to me. The application can just write information into the file which is read by PHP.
The other way round it looks not so good at first. PHP supports locking of files, but it most probably doesn't work on a system level. Perhaps one solution is that in fact every PHP script which has information for the application creates it own file (with a unique id filename, e.g. based on timestamp + random value). The application could watch a designated directory for these files to pop-up. After processing them, it could just delete them. For that, the application only needs write permission on the directory (so file ownership is not an issue).
If possible, use shell scripts.
I did something similar, i wrote a video surveillance application. The video part is handled by motion (a great FOSS package). The application is a turn-key solution on standardized hardware, used to monitor slot-machine casinos. It serves as a kiosk system locally and is accessible via internet. I wrote all UI code in PHP, the local display is a tightly locked down KDE desktop with a full screen browser defaulting to localhost. I used shell scripts to interact with motion and the OS.
On a second thought:
If you can use self-compiled applications on the device: Write a simple program that returns the value you want and use PHP's exec() or passthru() or system().