Cucumber example inputs are received incorrectly - selenium

Cucumber Version: 11.0
Facing a weird issue that first example input parameters are being taken along with other column values.
**Feature:** Some feature
#foo
**Scenario Outline:** Testing.
Given Send Request and Validate response <language> <location> <address>
**Examples:**
| language | location | address |
| test | tt | foo |
| test pp | mm | boo |
#Given("^Given Send Request and Validate response (.*) (.*) (.*)$")
public void Send_Request_and_Validate_response(String language, String location, String address) throws Throwable {
System.out.println("The language is " + language);
System.out.println("The location is " + location);
Expected:-
The language is test
The location is tt
The language is test pp
The location is mm
Actual:-
The language is test tt
The location is foo
The language is test pp
The location is mm
I am not sure why the first parameter 'language' in first inputs alone print 'tt' which is given under location. I see no such issue from second input. Any help?

Pls check if there are any special hidden characters between the demarcation line (i.e. | ) between "test" and "tt"

Related

How would I remove specific words or text from KQL query?

I have the following query which provides me with all the data I need exported but I would like text '' removed from my final query. How would I achieve this?
| where type == "microsoft.security/assessments"
| project id = tostring(id),
Vulnerabilities = properties.metadata.description,
Severity = properties.metadata.severity,
Remediations = properties.metadata.remediationDescription
| parse kind=regex id with '/virtualMachines/' Name '/providers/'
| where isnotempty(Name)
| project Name, Severity, Vulnerabilities, Remediations ```
You could use replace_string() (https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/replace-string-function) to replace any substring with an empty string

Karate : Dynamic text value in xml file

I want to provide dynamic values in the XML
test.xml:
<name>
<first>#(first)</first>
<last>#(last)</last>
<version>this is the #(version) in the file</version>
</name>
I have a .csv file:
first,last,version
abc,pqr,1
lma,qwe,2
Feature file:
call the csv and xml file
For first and last variable it works but for version it doesn't take version value
Yes, changing the tag name (or key name in JSON) is an advanced operation which "embedded expressions" cannot be used for. I think you should just use XPath. You should also take some time to read the examples linked from the documentation.
Here is just one way to do it, there are many more:
Scenario Outline:
* def payload =
"""
<name>
<first>#(_first)</first>
<last>#(_last)</last>
</name>
"""
* set payload /name/version = _version
* match payload == <name><first>foo</first><last>bar</last><version>1</version></name>
Examples:
| _first | _last | _version |
| foo | bar | 1 |

Partial text assertion and compare of 2 variables in selenium ide

I'm having a problem that I'm not sure how to solve. I have a customer code on one page (ex. Test095). I store it as var1. And I have to navigate to another page and verify that the code is the same. But on the second page the customer code looks like this : Customer Code: Test095. I store is as var2. So I have to remove Customer Code words from here , so I can verify that var1 equals var2. How can I get rid of Customer Code words?
open |www.link.com
verify title | Page
assert text| css=tr:child(1)-example | Test095
store | css=tr:child(1)-example | var1
open |www.anotherlik.com
assert text| xpath = //div[#id='myform']/div/div/p[4] | Customer code: Test095
store|xpath = //div[#id='myform']/div/div/p[4] |var2
verify| var2 | ${var1}
use java inbuit replace() function for string. Its better also to use trim incase to remove whitespaces
String s = "Customer Code: Test095";
s = s.replace("Customer Code:","").trim();
System.out.println(s);
To make this work in Selenium IDE
use command 'execute script', as i used in screenshot below
Here 'y' will store value Test095

How to pass response variable in path through examples table in karate

I am trying to pass a variable value in URL path which is further stored in examples table.
Unfortunately, it gives me error.
Can any one please help.
Background:
* def challengeID = res.challengeID
* def version = '2'
Given url dispatch And path '/api/fire/v' + version + '/sms/otp/' + <challengeID>
And param code = <code>
And header Content-Type = 'application/json'
When method GET Then status 400
Examples:
| challengeID | code |
| #(challengeID) | 2121211 |
| 3434343434343 | 111111 |
Sorry, the Examples: table cannot be dynamic. This is standard "Cucumber" behavior. Use table instead: https://github.com/intuit/karate#table
But I think you are over-complicating things. You should just do this:
And path 'api/fire/v' + version + '/sms/otp', res.challengeID

extract sub string from string in oracle

I have one of the following string :
(,QUESTION-3914~Please enter the unique identification number associated with the IRQ.|3~Greater Than|5~5,AND,QUESTION-3920~Select the contract action that applies to this IRQ.|5~Equal To|LOV1274~New Agreement,),AND,QUESTION-3921~If "New Agreement#comma#" which type of New Agreement is being requested?|5~Equal To|y~Yes,OR,NOT,(,QUESTION-3923~Will the Third Party Relationship support the implementation#comma# pilot#comma# launch#comma# or operation of a New Activity (as defined in the New Activity Risk Management Policy)?|5~Equal To|y~Yes,)
I want required ouput for this string is like :-
(,QUESTION-3914|3|5,AND,QUESTION-3920|5|LOV1274,),AND,QUESTION-3921|5|y,OR,NOT,(,QUESTION-3923)|5|y,)
What should i do for this ?
Use a regular expression to replace everything from each ~ tilde character until the next comma , or pipe | character (exclusive of that final character):
Oracle Setup:
CREATE TABLE your_data ( input_string ) AS
SELECT '(,QUESTION-3914~Please enter the unique identification number associated with the IRQ.|3~Greater Than|5~5,AND,QUESTION-3920~Select the contract action that applies to this IRQ.|5~Equal To|LOV1274~New Agreement,),AND,QUESTION-3921~If "New Agreement#comma#" which type of New Agreement is being requested?|5~Equal To|y~Yes,OR,NOT,(,QUESTION-3923~Will the Third Party Relationship support the implementation#comma# pilot#comma# launch#comma# or operation of a New Activity (as defined in the New Activity Risk Management Policy)?|5~Equal To|y~Yes,)' FROM DUAL
Query:
SELECT REGEXP_REPLACE( input_string, '~.*?([|,])', '\1' ) AS output
FROM your_data d
Output:
| OUTPUT |
| :--------------------------------------------------------------------------------------------------- |
| (,QUESTION-3914|3|5,AND,QUESTION-3920|5|LOV1274,),AND,QUESTION-3921|5|y,OR,NOT,(,QUESTION-3923|5|y,) |
db<>fiddle here