Selenium IDE: How to Pass Variables - selenium-rc

I have 3 different accounts in a website that I want to login and print a report every single day.
I've done a Selenium IDE recording that allows me to login and print the report, however, every day I have to change the variable 3 times (for the 3 different usernames and passwords).
How can I pass a variable to the "value" field of the "type" command?
Thank you.
Best,

You can go with parameterization
For parameterization you need to create js file
For eg. Js file contains
var username = ["parameterization1#mailinator.com", "parameterization2#mailinator.com");
var password = ["parameterization1", "parameterization2"];
You can upload this JS file to Options > Options... > General tab > Selenium IDE extension.
Sample script for parameterization

Try this way of using Selenium IDE - http://greenlanternautomationframework.blogspot.com/p/selenium-ide.html

Related

Exporting Sonarqube reports into Excel - based on major, minor and critical categories

Is there a way to export Sonarqube reports into Excel - based on major, minor and critical categories?
You can use the REST API, to query the data into JSON text and then export that JSON to a CSV file.
I used the command below to get a JSON response:
http://xxxxx.xx.xxxx.com:9000/api/issues/search?componentRoots=test_xxx_xx&statuses=OPEN,REOPENED&pageSize=500&pageIndex=1
Where componentRoots is the your sonar project name.
It gave all the issues in JSON and then I converted it in to a CSV.
The only way is to use the api/issues/search web service
Yes you can use the REST APIs provided with SonarQube to query. The documentation of APIs is also embedded into every Sonar instance as different versions expose different APIs.
We use Python for similar work as response will be in JSON and it will be easier to manipulate. Once you have arrived extracted issues of your liking, write them into .CSV or excel.
Link to web services will be in footer of Sonar Instance.
PS: Expanded answer to offset short-sighted answering. What is provided here is only abstract and not complete answer with query details.
Not recommended by community
With DB:- If you have been using Sonar for long and if you won't upgrade SQ too often you can choose to study table structure and understand how data is organised. We have done this too, but it gets messier with every passing upgrade (more inner queries). Cost of querying will be saved on bulk process of data as ES is not involved
Please try the following command to get all issues in JSON format. Then you may consider to parse output by using jason parser programs.
Replace "XXX:XXX" with Sonar Key defined in "sonar.projectKey" variable on "sonar-project.properties.txt" file
http://localhost:9000/api/issues/search?componentKeys=XXX:XXX
I used F12 developer tools to create the report. Here is step by step solution:
Before opening Sonar report, press F12 to open developer tools in the browser tab (Refer screenshot). Click on Network tab. Initially it'll be empty:
Open Sonar report in the same browser tab.
Now you have to select a request in URL column (Refer screenshot in point # 4). You've to select that request whose URL is of the format - https://sonar:8443/api/issues/search?. Base URL might be different depending upon the name of the server where you have hosted Sonar website.
Click on Response tab (Refer screenshot):
Copy the entire JSON data to clipboard. First press Ctrl + A and then Ctrl + C to copy the contents.
JSON data that you got is in below format:
Data of all the issues is present inside issues key. It is of array type as it contains a list of issues. Paste the entire JSON data into any notepad editor and get the value of issues node. A sample issues node data is shown below:
[
{
"key":"AYMBNpviy48WWZHdsU1Z"
,"rule":"OWASP:UsingComponentWithKnownVulnerability"
,"severity":"MAJOR"
,"component":"B91661CE-50F8-45CB-8F54-29CD044EF32D"
,"project":"B91661CE-50F8-45CB-8F54-29CD044EF32D"
,"flows":[]
,"status":"OPEN"
,"message":"Filename: jquery-ui-1.10.3.custom.js | Reference: CVE-2021-41184 | CVSS Score: 6.1 | Category: CWE-79 | jQuery-UI is the official jQuery user interface library. Prior to version 1.13.0, accepting the value of the `of` option of the `.position()` util from untrusted sources may execute untrusted code. The issue is fixed in jQuery UI 1.13.0. Any string value passed to the `of` option is now treated as a CSS selector. A workaround is to not accept the value of the `of` option from untrusted sources."
,"author":""
,"tags":["cve","cwe","cwe-937","owasp-a9","vulnerability"]
,"transitions":["confirm"]
,"actions":["set_tags","comment","assign"]
,"comments":[]
,"creationDate":"2022-08-18T06:35:49+0100"
,"updateDate":"2022-08-18T06:35:49+0100"
,"type":"VULNERABILITY"
,"branch":"sonarqubepr"
,"scope":"MAIN"
,"quickFixAvailable":false
},
{
"key":"AYMBNpviy48WWZHdsU1_"
,"rule":"OWASP:UsingComponentWithKnownVulnerability"
,"severity":"MAJOR"
,"component":"B91661CE-50F8-45CB-8F54-29CD044EF32D"
,"project":"B91661CE-50F8-45CB-8F54-29CD044EF32D"
,"flows":[]
,"status":"OPEN"
,"message":"Filename: jquery.ui.datepicker-ml.min.js | Reference: CVE-2021-41183 | CVSS Score: 6.1 | Category: CWE-79 | jQuery-UI is the official jQuery user interface library. Prior to version 1.13.0, accepting the value of various `*Text` options of the Datepicker widget from untrusted sources may execute untrusted code. The issue is fixed in jQuery UI 1.13.0. The values passed to various `*Text` options are now always treated as pure text, not HTML. A workaround is to not accept the value of the `*Text` options from untrusted sources."
,"author":""
,"tags":["cve","cwe","cwe-937","owasp-a9","vulnerability"]
,"transitions":["confirm"]
,"actions":["set_tags","comment","assign"]
,"comments":[]
,"creationDate":"2022-08-18T06:35:49+0100"
,"updateDate":"2022-08-18T06:35:49+0100"
,"type":"VULNERABILITY"
,"branch":"sonarqubepr"
,"scope":"MAIN"
,"quickFixAvailable":false
}
]
The JSON array data obtained in previous step is of real use. Convert this JSON array data into an EXCEL file using any online converter. I used the following website - https://www.convertcsv.com/json-to-csv.htm
What if my report has more than one page?
Sonar loads 100 records per page. To get the next page you've to click on Show More button at the bottom:
Every time you click on the Show More button, a new request goes to the Sonar server which will show up in the F12 developer tool's Network tab. So for all subsequent pages, repeat same set of steps to create a new Excel sheet per page. Then merge all the Excel sheets manually to create single master report.
Note: While merging the Excel files, remember that every Excel file will have a header row at the top. While merging the files, you'll have to keep the header row from from the first Excel sheet and ignore from the rest.

Not able to record the wep application when the url name is having special character in jmeter

we are using two URL for our web application .
One URL is having Special character and
another one does not have the special character. Without Special Character url , I am
to record the script but while using with Special character URL , I am not able to
record the script.
EX : http://test-qa.test.com -- not able to record the script
http://test.test.com - able to record the script
Please suggest and help to record the scripts
JMeter proxy should not have any problems with recording URLs with - sign, i.e. I can successfully record https://jmeter-plugins.org/ site browsing
So the problem must reside somewhere else.
You can try out the following options:
Create recording test plan using JMeter Templates feature. It will automatically populate the good recording configuration.
Consider using JMeter Chrome Extension instead of JMeter built-in proxy.

Windows batch dynamic URL script

Is there a possibility to set Website URL in dynamic way and open it with batch script? (by using e.g. start chrome "-URL here-")
Example.
I have a link with an excel file, which I want to download:
www.example.com/example_15/example_123.xlsx
and each day specific part of URL is changing, e.g. tomorrow it could be:
www.example.com/example_12/example_abc1.xlsx
Is there any way how I can replace changing parts of the URL so it would always download an excel file ?

JMeter - link clicking to generate a username

Sorry if this has been answered already, i tried to search but could get the exact information i am after.
The issue:
I am using JMeter to run some tests on a web application, as part of one of the flow, I under a first and surname in 2 input fields and i have link (Get userid) on clicking on the link the system will generate a user name. The user name is made up of first 4 letters from surname and first letter from the firsname and number at the end example: firstname is Test and surname is Environment, on clicking the get user id link the username will be generated as 'envit1' if 'envit1' is already existing then it would generated 'envirt2'
How do I simulate the click which generates the userid using jMeter.
Apologies but I am fairly new with JMeter, please ask if you need more infomratmation.
Many thanks in advance, Kay
If you're new to JMeter the best way to get things done is recording your user ID generation steps using one of the following approaches:
JMeter bundled HTTP(S) Test Script Recorder which acts like a browser proxy
A Google Chrome Extension which is capable of recording JMeter .jmx scripts right from your browser.
You can see what requests are being sent and HTML responses using handy View Results Tree listener.
However if clicking on link isn't being recorded, it's being handled by client-side Javascript. JMeter is not a browser and isn't capable of executing Javascript so you'll have to use WebDriver Sampler as Releasematic suggests.
You can use WebDriver Sampler but in each iteration it opens browser which may increase RAM usage. There is another option is to generate user id by running JS code in "JSR223 Sampler". With JSR223 Sampler you can run JS code but can't get access to DOM, so such JS code won't work:
function () {document.getElementById("edit-buttons-cleanup").click();};
You can install the plugin pack for the JMeter WebDriver sampler. Then, using some Javascript commands, you can start either a Firefox or a headless HTMLUnit and operate upon a webpage in a Jmeter step.

VS.NET Load Testing - pass site URL via parameter

I'm building VS.NEt 2010 Load Test solution.
Everything works really good except one thing. When I record .webtest script - it grabs the site domain name, like so:
http://test1/page1
http://test1/page2
So the test1 is hardcoded in the script.
What I would like to do is to run same load test again different test environment - the goal is to compare two environment without rewriting the recording.
I see that Run Settings has "Context Parameters" - is this it?
For for a recorded .webtest, this article shows using the context parameters with the {{parameterName}} syntax for form parameters, and can indeed be used for the server name.
From inside a coded test (which inherits from WebTest), you can access it with:
this.Context["KeyName"]

Resources