Selenium PhantomJS is it the same as running IE - python-2.7

I need to run my Selenium Python test script for IE.
If i ran it using a headless browser PhantomJS, is it going to be different than running it for IE?
I am asking because I am having a problem running my Selenium Python test script from a batch file from task scheduler.
I can run my batch file on it's own and that runs ok. But when i run it from Task Scheduler the browser does not open so the test fails.
The dev says Task Scheduler runs in the background with a headless browser.
If i used PhantomJS it won't be the same as IE?
I need to test it using IE but the batch file which runs my Selenium test won't open the browser from task scheduler.
My batch file is as follows:
set TEST_HOME=%~dp0
cd %~dp0
SET PATH=%PATH%;G:\test_runners\selenium_regression_test_5_1_1\IEDriverServer\64bit
cd %~dp0selenium_regression_test_5_1_1
set PYTHONPATH=%~dp0selenium_regression_test_5_1_1
c:\Python27\Scripts\nosetests.exe "%~dp0selenium_regression_test_5_1_1\Regression_TestCase\split_into_parts\RegressionProject_TestCase_Part1.py" --with-html --html-file="%~dp0selenium_regression_test_5_1_1\TestReport\SeleniumTestReport_part1.html"
I appreciate some help on this.
Thanks, Riaz

That's the same as asking, is the ouput the same in IE and in Firefox? Not exactly, visually it will look the same but in the source code some elements are adapted to the browser you're using.
Phantomjs is a browser on it's own, so, some elements can be hidden or not even loaded but it's rare. A good example of this is Twitter. I noticed during some tests that the click on the twit box to write some text behaves differently in phantomjs than in other browsers!
The reason why task scheduler doesn't let you use IE is because you can't use any graphical environments during the lifetime of the proccess.

Related

Harvard University CS50 Lecture on Flask

I am taking CS50 lecture on Python Flask
https://www.youtube.com/watch?v=oVA0fD13NGI&t=5449s
I am using PyCharm instead of VS Code. Here is my problem.
When I make changes in my PyCharm code and "Save All" I should be able to just "refresh" my browser to see the changes, (That's what the CS50 instructor can do), but I have to Stop and Start my Flask server and then go back to my browser in order to see the change.
Is there something I need to turn on and/or configure in PyCharm so that when I make code changes in a Flask application I can just refresh the browser without having to Stop/Start the Flask server. Thanks in advance for any help on this issue.
if you running your application with flask run in terminal, you can use --debug before run, to run in watch mode like this flask --debug run.
Have another away to run in watch mode.
You can use this code in your main file
if __name__ == "__main__":
app.run(debug=True)
when you run, you have to use python like this python app.py.
You can see more in the flask documents Here

WebStorm, setting JavaScript Debug with another task running before

In WebStorm I can very easy setup JavaScript Debug and then when I run this configuration, IDE opens the Chrome browser and all breakpoints are active. The problem begins when I need to run specific tasks prior to starting debugging, for example running npm build script. When I define it in Before launch (see the picture below), the Chrome browser not being opened when I activate this debug configuration but being opened after I stop it.
This requires from me, manually run a project from command line and then run Browser Debug
Can I define the additional tasks in a way that Chrome will be opened as usually?
Thank you.
A process added to Before launch section has to return an exit code, the main process is waiting for it to start and thus doesn't start until the first process terminates. This is the way Before launch is designed - it's supposed to be used to run some sort of pre-processing before running the main process. You can add a build task (a script that builds your app and then exits) to this section; but start:dev likely doesn't exit, it starts the server your application is hosted on, and it has to be running to make your application work, doesn't it? Please remove your npm script from Before launch, start it separately or use the Compound configuration to start both npm script and Javascript Debug run configuration concurrently

How to run tests on each hot recompile using SBT?

I'm running my Play Framework app using the command sbt run
When I change something in the code, it will "hot recompile" and serve my updated app.
I would like to run my unit test on each hot recompile.
I have tried things like
sbt test run but it will only run the test once. Then, all the other code change trigger "hot recompile" but no unit test.
I also tried sbt ~test run but it will wait for code change forever and never launch the app.
Is there a way to configure SBT so that it will always run the command "test" each time there is a hot recompile?
The closest I could get was running sbt and then using the command ~ ;test;run, which will run the tests and then launch the app in a continuous cycle (as long as there are changes) but still requires you to shut down the app with Ctrl-D to get back to running the tests.
My initial approach was trying to disable auto-reloading, but it appears to be hard-coded, and even that wouldn't be enough on it's own, as you'd need whatever the auto-reload hook uses to shut down the app with each change. So... technically possible, but not without creating a custom sbt task.

Lettuce test with django and selenium no run on windows

I have a lettuce test suite using selenium and everything works just fine on linux.
After I installed django and everything that's needed on windows to test the suite on IE8,9 too, and I tried to run the test, it only opens my browser and says that the test passed with 0 features, 0 steps etc. The same test suite on linux runs just fine.
What do I need to make them work on windows 7 too ???
I use python for my test.
Maybe it's not the best solution for you problem, I'm not even sure that it's valid for IE, but you could try to launch IE remotely so you will not need to launch whole application on windows (i.e. if you were using gunicorn as wsgi server, you couldn't launch on windows at all).
Python-selenium has functionality to use remote browsers, I'm just not sure about IE.

plone change in code not visible in development site

I am very new to plone. I have a project folder in eclipse. I have imported it from the cvs project. I have zope as server and I start zope with ./bin/instance restart. When I make changes in my folder, I cannot see the changes in the development website. I can't seem to find what is happening. I even restarted zope after making changes in python. Can anyone help me with this?
Make sure you start your Zope server with bin/instance fg, most likely the name of the script if you used the Plone universal installer buildout.
To see changes in python code you'll either need to restart the server (CTRL-C then start again) or use something like plone.reload to request a reload of changed code.
When starting your server with the fg command, it is automatically running in debug mode and any templates, resources and skin items are reloaded automatically. Start the server with console or start and it'll run in production mode and templates and such are loaded from disk only once.
See the Plone.org documentation on buildout for more information.
The bin/instance command has a built-in help command, try:
bin/instance help
for a list of supported commands or run:
bin/instance help console
to get help on a specific command; the above example will print the help on the console command.