Is there a way to run Selenium program outside of my PC? I'm happy with my code since its working as intended but running it over and over is annoying since its slowing my PC while opening and reloading browser. So my question is:
What should I use to run my script on something like host, Virtual Machines or something.
I'm pretty new to Selenium and Python so I dont know how to do it and i cant find enything useful on the internet that would help me.
Related
I am trying to create a python application while using eel to create a user interface in html. My operating system is Ubuntu Linux and I'm using Firefox to display the web interface.
The problem I'm having is every time I run the python code, Firefox opens a blank page saying "Unable to connect" followed by "Firefox can't establish a connection to the server at localhost:8000". However, if I click the "Try Again" button once, twice, or three times, my interface is displayed.
Once open, I can navigate to different pages but I also noticed that once I navigate to a different page, some of my javascript stops working (specifically a window.close() function). I don't know if this is related but I thought I would mention it just in case.
Any advice on the matter would be greatly appreciated.
Thank you.
I changed my browser from firefox to chromium and now my interface loads on startup the first time. I know some documentation says it can be used with firefox, and it can, but it seems to be kind of buggy and works better with other browsers.
However, I'm still having trouble with my javascript not running but that will be another question.
I'm automating a few things where I work regarding communication using WhatsApp. I have implemented a few scripts using Python (pywhatkit and MySQLdb) that acess my work's database and sends out a few text messages. The thing is, we currently have a local CentOS server up and running and I don't know how to make my script run on that. Like, I was told that the server had no graphical interface, and my script basically opens Firefox and sends texts every once in a while.
How can I make this work from this server? Is there another alternative? This will be used to send a couple of texts every day, so It won't be CPU intensive. Best use scenario would be to run this script every day at a scheduled time, and that's it.
You can use crontab to run script once per day.
Also you can open headless Firefox on CentOS server. Here good explanation how to do it.
I'm taking this course which requires us to ssh into a Qwiklabs Linux VM and write a python script to manipulate files and stuff on the VM. When I try ssh using PuTTY in windows 10, everything goes fine up to the point I have to run the script, then it returns invalid syntax errors. As far as I know, nothing is wrong with the code. The images linked will also show that the syntaxerrors point to stuff like valid variable names and even colons after for loops. I tested the code by trying to ssh into the VM through a mac and the script worked. Is there any way to fix this and make it run on Windows? Switching back and forth between computers is less than ideal for me and I also find it really intriguing because as far as I'm aware, it shouldn't matter which platform I'm connecting to the VM from because the python script is running on the VM. Hope someone can help, I'm a beginner and am really new to coding and ssh.python error img. Another python error img
There is nothing wrong with the VM. It is a problem with the code. From what I see in your error there is probably a unclosed parentheses above that line causing it to fail. I would need to see the code for more information.
I am trying to create a web application using flask. I have already gotten somewhat comfortable with using python, and have done so using spyder, inside of Anacanda Navigator. Now I am playing around with flask doing basic functions and have successful so far by testing it out in local server 127.0.0.1:5000. The problem I am having is that I cannot stop the server once I run the script in spyder. I have stopped the script and run other scripts through the console, but the local server remains the same.
The reason this is a problem for me is because when I try to change files and run a different flask script, the server does not update with the new information. For example, if I run a flask script that returns "Hello World" on the main page, and then I stop that file, open a new file that has a different flask script that returns "The sky is blue" the server does not change when I check it on chrome or any other browser. It will onyl return "Hello World"
I have been able to fix this problem by completely restarting my computer, but I am wondering if there is another way, just to restart the local server, 127.0.0.1:5000. Thank You!
Also I am using windows
I do : "Run > Configuration per file > Execute in an external system terminal",
then when you run your .py containing the app.run, it will be launched in an external console. If you close the console the server will be closed too.
To Kill the local server, you may use Ctrl+C command and not any other command. This command is also mentioned when the server is up and running.
I've been having this precise issue and have been smashing my head against the wall for a couple of hours. I posted the referenced StackOverflow question (my first actually) and it seems that running a script from inside Spyder is the wrong way to go as it leaves runaway background processes running, even after restarting Spyder.
I got the recommendation to only launch my *.py code from the command prompt. Furthermore I was told to do this:
set FLASK_APP=main1.py then set FLASK_DEBUG=1 then flask run
though I'm not sure what that does, so I will investigate. I was about to restart my computer as a last ditch effort until I looked in my Windows Task Manager and found some Python tasks running. After [end task] them both I was able to launch the updated webpage on my local host.
I am looking to create a usb drive that when inserted into a laptop will automatically run a python file (without any user interaction) which grabs their ip address and hostname and emails it to us in a text file. I know this seems sketchy, but it is for a pen test (I'm sure all of you are familiar with these kinds of tests)
I have the script already written, I just need to find a way to automatically run the script (regardless of what op system their running when somebody is dumb enough to put a usb drive into their computer... I have scavenged the web and found the "outrun.inf" ideas, but I know this does not work with all op systems...
My idea is to have it run command line commands when plugged into the laptop (which i can figure out later which command lines will work), but I am unsure if this is possible.. any ideas?
If their is another way you guys think could work to achieve what I am looking for, I am all ears!
Thanks all