Incorrect HTML content in Chromedriver - selenium-webdriver

I have several tests that write HTML code to a temp directory on a CentOS 7 box and then have Chromedriver load them up to do some basic tests on them. In this example I am writing the HTML code:
<html><body><form> <label for="text">Text</label>
<input type="text" id="text"></form></body>
However when I get the HTML content via getAttribute('innerHTML') I get this
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,
maximum-scale=1.0, user-scalable=no">
<title i18n-content="title">file:///tmp/formJbDsBv</title>
...
which is clearly not the code I wrote. The log file on the Selenium side is
09:45:03.980 INFO - Executing: [get: file:///tmp/formJbDsBv])
09:45:04.084 INFO - Done: [get: file:///tmp/formJbDsBv]
But, of course, the test works locally and on a virtual machine, but not on my test box, which runs using Xvfb.
Plus, the technique I use works on about a hundred other tests.

I don't know why this solves it, but adding .html to the end of the filename made it work. This is really weird because some of the tests that passed did not have .html at the end of their filename. Weird, but it's working now.

Related

Why does my react app is loading forever after npm start?

When I am starting a react app by "npm start" command in VScode terminal, it starts to loading forever on the browser. I am completely new to that so I have no idea what and where could go wrong. I have read that it may be because of mistakes in code so I deleted all the things which caused "compiled with warnings", but even though now terminal says "compiled successfully", nothing changed. In the browser it is stuck on loading...
Note that the development build is not optimized. To create a product build, use npm run build.
Does it have something to do with a problem? Looking forward to understand better what is going on. Thanks!
Update: so I loaded an index.html file through live server extension in vscode and opened up developer tools and I saw a bunch of problems, which are all referring to a syntax error in the very beginning of the initial htmls code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
That is what I see on dev tools:
Also, I tried "git status" in git bash and I see "nothing added to commit but untracked files present (use "git add" to track)" and it lists ALL of the files from my user folder.
Important note: earlier it was all fine and never have I ever seen all of these folders in a bash after running git status. Plus, I was even able to render react app.
I accidentally deleted the package.json. Restoring it solved my problem.
the main problem are:
You create an infinite Component, nesting the parent component in the parent component
https://i.stack.imgur.com/ngl1s.png
You import the wrong Component path so that it creates a nesting Component
double-check your path is exactly correct
or check by Comment your code, circling the Component that makes an error then fixing it
so if you can't solve it remember your Component is nesting, then it makes infinite localhost loading
I solved by myself

Is there some versioning in ReactJs that when set like in index.html automatically make browser get app again?

I learn Reactjs and read somewhere about this but cant find it now. how
to make the browser updated download the app files.
Again typically after a new release has been published?
Cache-control?
Like when I build a new version 1.0.1 and then next time 1.0.2 and then the browser should detect this and re download the changed files into browser cache.
Is there such thing?
UPDATE
here is my index.html with some Cache-control that dont work correctly
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=0" />
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>
..........
That functionality is built right into the HTTP protocol, but it works based on timestamps, not on versions.
With the HTTP request for your app's script, the browser sends along a timestamp of the cached version.
If that version is newer than the version on the server (i. e. it is up to date), the server replies with HTTP 304 Not Modified, and an empty body.
If the browser's version is out-of-date, the server will instead reply with HTTP 200 OK and the actual script.
(Note that this is subject to browser and server configuration, but this is how it is supposed to work, and usually does.)

angular js - new changes in the code are not executed

I am new to Angular js.
I have observed that new code blocks written in Angular js module file or controllers does not get executed sometimes and when the web site is refreshed surprisingly the code blocks get executed.
Is there any Angular js function to force the execution of code?
Is there a maximum limit in count of lines of code that can be executed?
It might be because of browser caching.
In each html template just add the following meta-tags at the top-
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
Or you can simply disable caching from Dev Tools.

angularJS in webstorm, display binding wrong

I am newly picking up angularJS, cannot figure out my situation here:
Everything goes fine when I just open official phonecat tutorial file.
However, if I create my own project, the binding never displays well, it also shows out "{{ }}".
Pictures show all I got here. I believe nothing wrong with the script referencing, just cannot figure out after tried hundred times.
It seems script referencing is not correct. Make sure that your script reference is correct.
I run the following code and it gave me the expected result.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body data-ng-app>
<p>{{1+2}}</p>
</body>
</html>
See Demo
In the browser check the source. Does angular exist in your browser.

Angularjs 1.2 Explorer 8 doesn't respond

I'm trying to make work a form in internet explorer 8 and angularjs 1.2. I may say that it works perfectly in last versions of Chrome and Firefox.
The site to see this: http://barcimaster.com/solicitud_de_presupuesto/1
I made a fiddle also to see a simple version: http://jsfiddle.net/r01010010/e9kvd/11/ but it doesn't work!
So, what i'm missing. I already tried using:
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
But nothing happens... i tried to debug the function but never gets into the function "update".

Resources