Selenium IDE Base URL and Open commands - selenium

What is the use of Base URL is Selenium IDE because even when I enter the wrong URL there or leave it blank, and run the script, it just runs fine.
I have this URL, as base URL http://test.info:50/test and in the open command when I use the part /test of the URL, so the URL to be opened should be http://test.info:50/test/test (which is not the actual URL) and selenium keeps running the script on the Base URL above and shows no error.
So, my question hear is what is the use of Base URL when it could be left blank or empty. What is the use of the Open command when I have used the full URL in the Base URL part.
Hope the question is clear. Please help.

The base URL should be the index of your site. NOT the directory under test.
For example,
BaseURL: http://google.com/
Open: /search
This will open http://google.com/search as the beginning Url. From then, you should continue testing.
In your case, specify
BaseURL: http://test.info:50/
Open: /test
And you'll be golden.
EDIT:
and selenium keeps running the script on the Base URL above and shows no error.
Selenium IDE will show no errors because Selenium IDE doesn't care where your test is ran.. it's not limited to that (nor should it be). It will only spit out an error for something is wrong in your script. Nothing to do with your opening of urls. You could open something like /somebullcrapdirectory and it'd still be fine. It'd fail at the point of performing any subsequent actions though, since /somebullcrapdirectory would actually be an invalid directory.

I hope you understand Abhi,
When user give the blank base url after that comes the error,
[warn] Base URL is not set. Updating base URL from current window.
[error] baseUrl wasn't absolute:

We can simply use the open command and leave the target section blank.
This will use the base URL and open it.

The URL specified in Base URL input field in de Selenium IDE, and the URL specified in the target parameter of the open command, will not just simply be concatenated. Opening /test/ will just be seen as an absolute URL for your domain.
You can, however, specify a target ./test/, which requests, as I experienced, requests http://test.info:50/test/test/. I find this very useful, as in some environments, my web application will reside on the root and in some other environments in a base path like /myapp/.
With respect to a blank Base URL, I assume that this worked because the browser page in which the test was run already showed a page from the correct domain. If you would have executed the open command on a page in any other site, the open command would have requested the page /test/ from that site. After that, that base URL would have pointed to that site.

Related

How to set properly QPKG_WEBUI variable in QNAP

I am trying to developing an App for QNAP. I am really noob about QNAP, so please help me!
I succeeded in creating a qpkg package and installing it correctly, and it works. But the problem arises when I want to give my app a web interface.
I have just a index.html file that just has an helloworld text inside.
I create the environment with the QDK and I have the /share/XXX_DATA/.qpkg/QDK/MyApp folder
Now, a part of the other files, I create
/share/XXX_DATA/.qpkg/QDK/MyApp/Web
and put there my index.html with my HelloWorld message.
Ok now, I modify the /share/XXX_DATA/.qpkg/QDK/MyApp/qpkg.cfg file and set the variable
QPKG_WEBUI="/MyApp/Web"
From the documentation, for example https://edhongcy.gitbooks.io/qdk-qpkg-development-kit/content/qpkg-configuration-file.html , I can see
QPKG_WEBUI
Relative path to installed application's web interface (the
specified path is relative the configured location of web server data;
usually /share/Web or /share/Qweb.) The specified path must start with
a '/'. The displayed link can only be accessed when the QPKG is
enabled. A default value of '/' is set automatically at installation
if QPKG_WEB_PORT has been given a value and QPKG_WEBUI is empty.
Then I also create a link in /share/XXX_DATA/Web folder to my web folder.
(the /share/Web is just a link to /share/XXX_DATA/Web)
That is:
ln -s /share/XXX_DATA/.qpkg/QDK/MyApp/shared/Web /share/XXX_DATA/Web/MyApp/Web
Well, what happens that now, I can open a Window in my QNAP when I click on "open" in my app but it is completely blank. I tried a lot of different variants but my window is allways blank.
Must I modify something more a part from the qpkg.cfg file?
Do you have some documentation with sample codes?
Is QPKG_WEBUI the correct variable to modify?
Thanks very much to everyone
After a carefully study of the problem, and after trying other applications with the same problem, I found the conclusion that the problem was not the QPKG_WEBUI variable.
The problem was that my QNAP web interface (I do not know if it is a general thing for every QNAP or only in my case) has as default port 8080, but the WEBUI have as default port 80.
Then it seems that the web browser blocks the WEBUI in the iframe inside the QNAP interface in order to follow the Same Origin Policy. When opened in a new window, the WEBUI works correctly.
Setting the QPKG_USE_PROXY=1 variable let the iframe work too.

Browser Caching Versions in Google Chrome with Tampermonkey

I have a question about caching versions of imported files (via web requests) in Google Chrome:
Let's say I have script.js, whose URL is:
http://www.getscripts.com/script.js (URL contents arbitrary after "http://", because TamperMonkey imports over the HTTP protocol)
If I import the script in Tampermonkey using #require, I want to use a query string for its version to avoid caching.
Caching versions:
Let's say, that I first #require the 1st "version" of the script (created it, and inserted initial content), by giving the require a URL of http://www.getscripts.com/script.js?v=1, so I pass in the URL a query string of the version v=1, and that the script file of version v=1 was not cached already.
I make some changes to the code of script.js, and the script that the URL provides also gets updated (I use surge.sh).
Then, I change my #require URL to: http://www.getscripts.com/script.js?v=2, so I pass in the URL a query string of the version v=2
Then I make some more changes in the code, make sure the URL gets the updated file, and give the #require my initial URL with v=1: http://www.getscripts.com/script.js?v=1
Question:
The script file that will be returned (via an HTTP request) - will it be of version 1, or 2?
What I'm doing is trying to force-download a new version of my script file, after I update the script's code, since Tampermonkey caches script files without re-downloading them, unless there was some changes made in the URL of the #require (what does the HTTP request).
This was solved by forcing the browser to download a new version of the script by adding a version parameter to the script's URL, as suggested by wOxxOm above.

How to default HTTP request to servername followed by path in JMeter

I'm new to JMeter and am having trouble figuring out how to get my default URL to be what I want it to be. Right now, I've added an HTTP Request Defaultsconfig element to my test plan. In the Web Server box I have a url of the following format:
testproject.company.com
What I actually want the default URL to be is
testproject.company.com/test
The first thing I tried was setting the Server Name or IP to testproject.company.com/test, but this gave me an error
java.net.UnknownHostException: testproject.company.com/test
Next, I set Server Name or IP back to testproject.company.com and filled in the Path box in the HTTP Request section with
/test
This does not cause any errors, but all of my tests fail because it is simply using testproject.company.com as the default URL.
I am also using a Project Files config, and within the Configure the CSV Data Source section, in the Filename box, have the path to a .csv file. The .csv file has the following contents:
testproject.company.com/test/,username#testproject.train,10,true,WIN
What's preventing JMeter from adding /test to the default URL?
I believe the issue is due to a misunderstanding of the Path field under the HTTP Request Defaults section. It appears that the path in that section will only be used for tests where a path is not defined. So instead of adding the path from the test to the default path, it simply replaces it. Because of this, you have to manually add the path to each test that specifies a path.
If anyone knows of a better way to do this, let me know!
Use userdefined variables
Declare the "/test" as PATHVARIABLE in a user defined variable.
In each request append the variable to the path
${PATHVARIABLE}/yourUrl
Add "HTTP Sampler" under Thread group. In HTTP Request Defaults define Server IP as testproject.company.com and in HTTP Sampler define "/test" as Path.Leave the Server Name or IP field blank.
Thanks
The first thing I tried was setting the Server Name or IP to
testproject.company.com/test, but this gave me an error
java.net.UnknownHostException: testproject.company.com/test
It appears that this error is given depending on which "implementation" you are using for the HTTP Request sampler.
Setting the implementation to anything other than 'Java' (e.g. HttpClient4) solved this problem for me.

Issues with intern-runner and proxyUrl that contains subfolders

I need to setup intern to test ajax calls from a different server. I set everything up sort of following the official wiki in this address
https://github.com/theintern/intern/wiki/Using-Intern-to-unit-test-Ajax-calls
My config file has proxyUrl set to http://localhost:8080/sub
and http://localhost:8080/sub is setup as a reverse proxy to inter-runner in http://localhost:9000
When I run ./node_modules/.bin/intern-runner -config=tests/config from the tests root folder, the browser opens up and is able to request several files, until it tries to request the config file. That's when it receives a 404, because it requests the wrong address - http://localhost:8080/tests/config.js - without the sub folder.
I'm wondering if I'm missing something inside the config file, or if intern is not able to use proxies with subfolders. I tried to set the baseUrl parameter, but it had no effect.
Any ideas?
Update:
It seems that sometimes intern-runner uses the path provided in the config param, and sometimes it uses the one in the proxyUrl parameter inside the config file. As a workaround, what I did was to place the config file and the tests on 2 folders (actually I made a symbolic link). The first on tests/ and the second on sub/tests/ and ran it using ./node_modules/.bin/intern-runner -config=sub/tests/config.
It works, but it's kind of stupid and I really wished there was a better way to do it.
This is indeed a limitation/bug of intern. It assumes that the proxy sits at the root of the absolute domain name, i.e. that it has a pathname of /.
An issue has been created on intern's github repository here and the corresponding pull request that fixes the problem is here. Hopefully this gets merged into the upcoming 2.1 release of intern.

Selenium: Taking forever to open browser

It is taking forever for Selenium to open browser. Command line shows the following:
It looks like your baseUrl (http://localhost/indico) is pointing to a file, not a directory (it doesn't end with a /). We're going to have to strip off the last part of the pathname.
Create a folder with name indico and then keep your html files in it.
Now give http://localhost/indico/ as base url and /main as absolute URL which appends the base url and become http://localhost/indico/main .
Regards
The firefox driver is much faster than the ie one. Maybe you should start off with that one and continue from there.