Development

I wonder if there is a way to assert that XML response does NOT contain any other tags than those expected?
I am using plain http requests (no WSDL, schema validation, not SOAP, not REST) and the application protocol is custom for a particular application (POS systems).

I was thinking (and started) of creating a custom SOAPUI library with script that contains:

a reference table
a function that checks if returned tag is on the list (in reference table)

if the returned tag is not on the list, then assertion fails

So, my question is: is there a better way to validate that?
The response XMLs have a lot of fields, some mandatory, some optional and some conditional depending on other (within same request).

While testing Hybrid android app in Appium, a change of context from NATIVE to WEBVIEW is expected. But, the name of the WEBVIEW context does not remain same at all instance of testing. However, it is one of the follwing:

WEBVIEW_undefined
WEBVIEW_{package_name_of_application_under_test}

Say, I’m testing a Hybrid app with package name

com.webviewbrowser

In this case, the context name of the WEBVIEW switches randomly between the following two at every instance

WEBVIEW_undefined
WEBVIEW_com.webviewbrowser

When I use the following in my code,
driver.context(“WEBVIEW_com.webviewbrowser”)

Miserably, I actually receive the context name WEBVIEW_undefined sometimes and NosuchContextException is thrown.
Why does this happen even when no other app is running at the time of testing?
How do I get rid of this issue?

I’m testing a web application in which all web controls are loaded dynamically using AJAX. I have a test script project in java Eclipse IDE.

Here is my problem. If, for example, I am debugging a test script for my last module, I have to go through all my dependent modules first and execute each one’s script before I can debug my last module. It is a very time consuming and boring task to execute the scripts for previous modules every time.

Is there a way I can bypass my dependent module test script execution in Eclipse?

I’m starting to get frustrated with Chrome emulator:
Using JAVA + Selenium + TestNG I’m testing many of our web applications which runs on few browsers. On mobile browser we have a special design – and NOW i’m trying to test it with the Chrome emulator but without great success. I can only load a page and check the elements, BUT I CAN’T click() on it (or other interactions with Actions object).

I’ve tried a simple :

someElement.click()

and

Actions action = new Actions(driver);
action.moveToElement(someElement).click().build().perform();

and both doesn’t work. The run just stays there until the test case gets time out.

Any ideas?
Thanks

I’m writing automation script for a page in which there is a text box. The scenario is as follows:

I click on the text box and enter a value which will throw error
I clear the text box and add valid value and click on confirm button
Then I see the answer provided in the text box as an answer bubble
I click on the edit button to change the answer bubble back into text box
I clear the text box and add new value

In the last step where I need to clear and add new value to the text box, what happens is that the text box is not cleared even when the code is there to clear it. In step 2 it does clear the text box.
public void enterElectricityReading(String electricReading) {
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.elementToBeClickable(electricityField));
electricityField.clear();
electricityField.sendKeys(electricReading);
}

Can someone help me to understand why does the clear code is not run and value is not cleared?
At a certain period when the test is run then the clear method works. But it is not reliable.

Precondition: Need To Login Application first, then I can send my API request to the server, so who can set this thing in Jmeter?

Current: I am getting error as

“{“Message”:”Request was not made within the context of a valid
session.”,”Data”:”ErrorId: “}”

I am repeatedly getting a very annoying problem when automating my test cases using Selenium/C# in Visual Studio.

This test is designed around validating search criteria text. In order for me to test each criteria, I have to:

Navigate to the the app’s homepage
Click on the search app
On the search page, enter valid criteria
On the search results page, assert that the search criteria appears in text as what was searched for.
Repeat steps 1-3 with different search criteria.
Verify all search criterias on the results page appear as they should.

When I get to step 5 (navigating back to the homepage), I get the following exception:
“threw exception:
OpenQA.Selenium.StaleElementReferenceException: Element is no longer valid”

I had gotten this before and got around it by adding a “wait.Until(ExpectedConditions.ElementIsVisible” command- not entirely sure why this worked.

However, the above solution is becoming very tedious as it requires me to enter an instance for EACH element that I call to, which will end up being x30 more.

Any help will be greatly appreciated.

I was following blazemeter tutorial on how to run Jmeter script from the command line (cmd.exe in Windows10 OS). I’m trying to pass environment variable to the Jmeter ${__env} (according to this page) custom function, using Jmeter script from the command line. Below is the screenshot of the env function in Jmeter UI

I’ve also tried without quotes ${__env(password)} and also using JSR223 PreProcessor

vars.put(“password”,${__env(password)});

but that didn’t work either.

Below is my command line

set password=MyPassword123
jmeter -n -t C:WorkJmeterMyScript.jmx

But Jmeter fails to execute my test plan

Creating summariser <summary>
Created the tree successfully using C:WorkJmeterMyScript.jmx
Starting the test @ Fri Sep 28 16:45:38 EDT 2018 (1538167538606)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary = 2 in 00:00:01 = 3.1/s Avg: 250 Min: 1 Max: 499 Err: 1 (50.00%)
Tidying up … @ Fri Sep 28 16:45:39 EDT 2018 (1538167539431)
… end of run

Is it possible to read environment variable using Jmeter? How to properly set it up. Has anyone able to achieve this before? Thanks a lot people!

I have customized UI calendar attached in screenshot having date and time slots to book some test drive. actually the booked slot div contains some class and available slot contains some class name.
Please give suggestion to click next available slot containing div.

Unavailable slots are marked as grey and booked slot are mentioned with comment and available are white.

Attached code also for locator.

I have used soft assertion in my test cases, but it stops the execution of all the next test cases. what I know if we are adding soft assertion then particular test case should fail and it should jump to the next test case successfully. Below is

my code:

public static boolean verifySelectEquipmentDivision1(){
try{
int count=0;
String[] eqipDiv={“A”,”A&B”,”CE”};
WebElement eqipDivdDropdown=Driver.getDriver().findElement(By.xpath(PageUtility.SELECT_EQUIPMENT_DIVISION));
Select selectTimePeriod=new Select(eqipDivdDropdown);

List<WebElement> eqipDivOptions=selectTimePeriod.getOptions();
for(WebElement we:eqipDivOptions){
for(int i=0;i<eqipDiv.length;i++){
if(we.getText().equalsIgnoreCase(eqipDiv[i])){
count++;
}
}
}

if(count==eqipDiv.length){
System.out.println(“matched”);
}
else{
System.out.println(“not matched”);
}
}

catch(Exception e){
System.out.println(“not selected”);

}
return false;

}

If am not adding assertAll(); it successfully execute my test cases, but to show this test case fail, I have added asserall() method and it stop execution of next test cases;

public void verifyEqiDiv()
SoftAssert ssoftassert=new SoftAssert();

@Test
softAssert.assertTrue(CommonAssertion.verifySelectEquipmentDivision1(), “selected eqip div not found”);
// softAssert.assertAll();
createNewReport.selectEquipmentDivision();

}

I am able to input the username, the password, and then click on the login button, but after clicking on the login button it displays nothing on webpage in IE11 but works fine with Chrome and Firefox.

Could you please help me what might have gone wrong?

I’m working with an automated script for multiple checkboxes that has dependent permissions.

Given there are multiple checkboxes

Checkbox A
Checkbox B
Checkbox C
Checkbox D
Checkbox E

When I select Checkbox A
Then Checkbox C and Checkbox E is selected

I’ve handled this using a switch statement because there are multiple combinations but its kind of messy because certain checkbox(es) are not only selected but disabled as well due to the dependent permissions:

e.g.

public boolean multipleCheckboxVerification(String roleName) {
switch (roleName) {
case CheckboxA:
return permissionPage.isSelectedChkA() && permissionPage.isSelectedChkC()
&& permissionPage.isSelectedChkE() && !permissionPage.isEnabledChkC() && !permissionPage.isEnabledChk();}

May I kindly know if there is a cleaner way to return which checkbox isn’t as expected?

I’m currently just using assertTrue from TestNG but the output seems to be vague of which checkbox is actually failing.

I was looking for an output where the error message would display “Checkbox E is enabled where it should be disabled”

I’ve been using Selenium for a while but with a slightly different scope (actually constraints). Instead of running a test for a particular site, I’m interested for instance in filling in a web form from a third party site and get some result, for instance downloading a file, to ensure its quality. So, I’m mainly interested in using Selenium to interact with a browser. So far, so good. I’ve been able to achieve what I wanted.
So, as I’m not interested in “testing” using a Unit Testing Framework like MSTest, I started to use Selenium in a normal C# console application. That worked great!
Afterwards, instead of launching Selenium from a Console I tried to do it from: 1) a WCF Application; and also from 2) an ASP.NET Web Application.
Those 2 approaches worked fine while being launched from within Visual Studio.
However, when I deployed and tried to run those 2 different approaches the Seleniumn InternetExplorerDriver server (the same with chromedriver) was never launched as opposed to what happened when being run from the Console Application.
I’m getting the following error:
OpenQA.Selenium.WebDriverException: A exception with a null response was thrown
sending an HTTP request to the remote WebDriver server for URL
http://localhost:3227/session//window. The status of the exception was ConnectFailure,
and the message was: Unable to connect to the remote server —> System.Net.WebException:
Unable to connect to the remote server —> System.Net.Sockets.SocketException:
No connection could be made because the target machine actively refused it 127.0.0.1:3227
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
— End of inner exception stack trace —

I’m stuck there. I guess it may have to do with who is the Host from where the Selenium Web Server is being run and their privileges. That’s whether it is a Console, a WCF App or an ASP.NET Web App (hosted in IIS) but I don’t know what to do or where to look to sort this out.

I am currently having issues with locating an pseudo element for a web page. I have checked other articles to use javascript and tried but it still isnt getting it. Below is a screenshot of what the html is like and the code I wrote to get property and to be able to click on it. Your help will be needed guys
enter image description here
<div class=”article-actions” xpath=”1″><app-article-meta><div class=”article-meta”><a href=”/profile/test1234″><img src=”https://static.productionready.io/images/smiley-cyrus.jpg”></a><div class=”info”><a class=”author” href=”/profile/test1234″> test1234 </a><span class=”date”> June 29, 2021 </span></div><span><a class=”btn btn-sm btn-outline-secondary” href=”/editor/sdsd-r6g7gi”><i class=”ion-edit”></i> Edit Article </a><button class=”btn btn-sm btn-outline-danger disabled”><i class=”ion-trash-a”></i> Delete Article </button></span><span hidden=””><app-follow-button><button class=”btn btn-sm action-btn btn-outline-secondary”><i class=”ion-plus-round”></i> &nbsp; Follow test1234
</button></app-follow-button><app-favorite-button><button class=”btn btn-sm btn-outline-primary”><i class=”ion-heart”></i> Favorite Article <span class=”counter”>(0)</span></button></app-favorite-button></span></div></app-article-meta></div>

WebElement pseudoEle = driver.findElement(By.xpath(“//button//i[@class=”ion-trash-a”]/parent::button”));
String display = ((JavascriptExecutor)driver).executeScript(“return window.getComputedStyle(arguments[0], ‘:before’).getPropertyValue(‘content’);”,pseudoEle).toString();
System.out.println(display);

I also need to be able to click on the element. Note the xpath returns two of the pseudo element that are identical on the page.

I used JMeter to record an ASP.Net application.
Most of the recording part are works perfectly fine. There is no error and the contents display correctly.
However, there are some test steps which cause the contents on the landing page to display incorrectly.
I turn off the proxy and execute the same test steps, there is no error and the content displays correctly. It happened for every browser; IE, Edge, Google chrome and Firefox.
Please help.
using JMeter 5.4.1.

I am trying to run a test with 11 steps, and I want to define a curve of how frequently tests will be sent. That is, I want to start off with one request per second, then graduate that until I hit a maximum of 15 requests per second, sustain that for a period of time (say, 10 minutes), and then end the test. Is this possible or is the only way to start at that number of requests immediately?