Libraries & Frameworks

I’m trying to get the scroll time of a carousel. I tried to take time when 1st element is selected and time when 2nd element is selected, then deduct 2nd time from 1st time and get the duration.
Below is my code.
//list of carousel button
List<WebElement> button = driver.findElements(By.xpath(“//ul/li/button”));

//calendar instance
Calendar calendar = Calendar.getInstance();

//start time
int scrollStartTime = 0 ;

//end time
int scrollEndTime = 0 ;

for(int btn=0;btn<button.size();btn++) {

if(button.get(0).isSelected()) {

//get start time in mill seconds
long startTime = calendar.getTimeInMillis();

//convert to int
scrollStartTime = (int)startTime;

System.out.println(startTime);

}if(button.get(1).isSelected()) {

//get end time
long endTime = calendar.getTimeInMillis();

//convert to int
scrollEndTime = (int)endTime;

System.out.println(endTime);
}
}

//get the time gap take to change images
int scrollerTime = scrollEndTime – scrollStartTime ;

System.out.println(scrollerTime);

I am not getting any out put. There are no errors. Can some one guide me to get the out put?

We have developed a Windows application using Winforms. Now we are trying to convert it to Universal Windows Platform (UWP) using desktop to appx bridge.

I have to test this app and I’m new to UWP. I know I have to test all the app functions and make sure they work the same way as the original application, but I need to know what to look for that is specific to UWP.

Are there any test scenarios that only happen with UWP, and if there are, how do I test for them?

Businesses are moving to the cloud, a smart way to experience many advantages like agility, scalability, and overall competitiveness. Cloud platforms offer the necessary infrastructure to support integration and continuous delivery continuously (CI/CD) pipelines.
The post Cloud Based Test Automation – Supporting Agile and DevOps Practices first appeared on TestingXperts.

I am able to modify http request header using BrowserMobProxy, the same way explained

https://sqa.stackexchange.com/a/37318/9043

But, the problem I am having at the moment is, that I am executing my scenarios on dev/local/playpen environment (environment before System integration testing). And to open the website on this environment needs proxy to set.

When I set my proxy then it fails to modify header and apply the proxy. When I comment the proxy part then it easily modifies the header.

BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.start(0);
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);

proxy.addRequestFilter((request, contents, messageInfo)->{
request.headers().add(“some-header-attribute”, “RandomeValue”);
System.out.println(request.headers().entries().toString());
return null;
});

String _host = Utils.getConfigValue(“proxy.host”);
String _port = Utils.getConfigValue(“proxy.port”);

seleniumProxy.setProxyType(Proxy.ProxyType.MANUAL);
seleniumProxy.setHttpProxy(_host + “:” + _port);
seleniumProxy.setSslProxy(_host + “:” + _port);
seleniumProxy.setFtpProxy(_host + “:” + _port);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

String proxyOption = “–proxy-server=” + seleniumProxy.getHttpProxy();
options.addArguments(proxyOption);

I’m trying to use a custom profile in Firefox with an add-on, I can open the profile, launch URL, I even see the add-on icon on top bar but is always set into the disabled mode, I need to set it to active all time. The add-on is ‘anonymous’
below is what I did, but no success.

public class SeleniumScript {
static WebDriver driver;
public static void main(String args[]) throws Exception {
System.setProperty(“webdriver.gecko.driver”, “E:\Library\geckodriver-v0.21.0-win32\geckodriver.exe”);
ProfilesIni profile2 = new ProfilesIni();
FirefoxProfile profile3 = profile2.getProfile(“AutoProfile”);
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setProfile(profile3);
File file = new File(“C:\Users\xxx\AppData\Roaming\Mozilla\Firefox\Profiles\vjo848oc.AutoProfile\extensions\client@anonymox.net.xpi”);
profile3.addExtension(file);
profile3.setPreference(“extensions.anonymox.currentVersion”, “4.1”);
driver = new FirefoxDriver(firefoxOptions);
String baseURL = “http://abc.com”;
driver.get(baseURL);
driver.manage().window().maximize();
}
}

I have an HTML element with a disabled attribute that is either true or `false, like:
<div class=”row” disabled=”false”>

or
<div class=”row” disabled=”true”>

I thought this would be straightforward to verify in Cypress by doing something like:
cy.get(“div.row”).should(“have.attr”, “disabled”, “false”)

However, when I tried that the test fails because Cypress reports that the disabled attribute of the element does not have the value “false” but instead has the value “disabled”.
If I open the browser inspection tool I can verify that the attribute is shown as I’ve written above. Any idea what is going wrong?

<select id=”SelectedCustomerRoleIds” multiple=”multiple” name=”SelectedCustomerRoleIds” data-role=”multiselect” aria-disabled=”false” style=”display: none;” xpath=”1″>
<option value=”1″>Administrators</option>
<option value=”2″>Forum Moderators</option>
<option value=”4″>Guests</option>
<option value=”3″ selected=”” style=””>Registered</option>
<option value=”5″>Vendors</option></select>

I have tried the following code to deselect option 3 – Registered and select option 4 – Guests.
WebElement element= driver.findElement(By.id(“SelectedCustomerRoleIds”)):
Select select = new Select(element): select.deselectByValue(“3”):
select.selectByValue(“4”)

I’m using SoapUI to test REST webservices and I’m stuck on an issue.
I have a json object, called coverages, which consists of one or more other objects, it looks something like this (example with 2 coverages):
“coverages” : [
{
“CovNr” : 123,
“CovDesc” : “My coverage”
},
{
“CovNr” : 456,
“CovDesc” : “Another coverage”
}
]

The thing is, sometimes there is one coverage, and sometimes there are multiple. This means I need the coverages object to be variable, and have either one or more coverages as its body, depending on # of coverages.
Since the number of coverages isn’t always the same I can’t use properties for the CovNr and CovDesc attributes. Also I can’t just always add like three and leave two empty if only one is used (can’t have empty attributes).
I tried to set a coverages property using groovy script, which consisted of the entire body of the coverages object, but that didn’t work (I’m guessing the editor can’t parse an entire part of a request from a property).
Example of what I tried:
in groovy:
def coverages = “[ { “CovNr” : 123, “CovDesc” : “My coverage” }, { “CovNr” :456, “CovDesc” : “Another coverage” }]”
testRunner.testCase.setPropertyValue(“coverages”, coverages)

in request body:

“coverages” : “$(#TestCase#coverages)”,

This didn’t work.
Is there another way to add a variable number of coverages to my request body?

Code:

public class AppDAta {
public static URL url;
public static DesiredCapabilities capabilities;
public static AndroidDriver<AndroidElement> driver;

//1
@Test
public void setupAppium() throws MalformedURLException {
//2
final String URL_STRING = “http://127.0.0.1:4723/wd/hub”;
url = new URL(“http://127.0.0.1:4723/wd/hub”);

//3
DesiredCapabilities cap= new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, “Nexus_4_API_27”);
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, “android”);
cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, “3.6.0”);
cap.setCapability(MobileCapabilityType.APP, “/Users/uss/Desktop/untitled folder/Appium/src/main/java/Appium/ApiDemos-debug.apk”);
cap.setCapability(MobileCapabilityType.NO_RESET, true);
// cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, “XCUITest”);
cap.setCapability(“useNewWDA”, false);
//4
AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(url, cap);
driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
//driver.resetApp();
}

}

Getting this type of error in console:

FAILED: setupAppium
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not find ‘adb’ in PATH. Please set the ANDROID_HOME or ANDROID_SDK_ROOT environment variables to the corect Android SDK root directory path.
Build info: version: ‘3.6.0’, revision: ‘6fbf3ec767’, time: ‘2017-09-27T15:28:36.4Z’
System info: host: ‘tests-Mac-mini.local’, ip: ‘fe80:0:0:0:431:f1c:51d3:566a%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.6’, java.version: ‘1.8.0_111’
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not find ‘adb’ in PATH. Please set the ANDROID_HOME or ANDROID_SDK_ROOT environment variables to the corect Android SDK root directory path.

I have a value with the following format [aadrzr@r2za$l919d@ldzkld], but when asserting this value in the response assertion, I am getting a failed response assertion. Since it contains special characters.
How I can solve this. Notice that the value is auto generated and I don’t know what value format will be retieved.
Example:
“key”: “aadrzr@r2za$l919d@ldzkld”,
Response assertion :
failed

Azure DevOps is triggering and running tests on a VM.
All my tests are working fine on local machine.
On VM, While trying to launch Chrome browser using ChromeDriver and WebDriverManager, tests are failing at LaunchChromeDriver method with failure as ‘Access is Denied’ at step new ChromeDriver(options);
This is how the method looks like:
public static IWebDriver LaunchChromeDriver()
{
try
{
new WebDriverManager.DriverManager().SetUpDriver(new ChromeConfig());
ChromeOptions options = new ChromeOptions();
driver = new ChromeDriver(options);
return driver;
}
catch(Exception e)
{
log.info(“Exception is “+e);
return null;
}
}

Am I missing something or do I need to modify the code?
Did anyone experience the same?
Getting an exception as below:

System.ComponentModel.Win32Exception (0x80004005): Access is denied
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at OpenQA.Selenium.DriverService.Start()
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)

My current project is written in C++. It takes a certain config file to do various work. There are a large number of parameters inside the config. I would like to do randomization test for those inputs. What I would like to achieve is following:

For each parameters, I do uniformly randomization with its own constraints.
The whole testing sample would be drawn uniformly from whole parameter space.

I am new to software testing. What I would like to achieve is something like UVM does for hardware verification. I am wondering if there is any framework for this. Python is preferred.
Thanks

Hope you doing well,

I’m trying to dragAndDrop an element from FrameOne to FrameTwo but not able to do so.Please help me to understand the concept and what I’m doing wrong here and need to achieve the task by using Actions class only.

Here’re the URLs :

https://www.w3schools.com/html/html5_draganddrop.asp
Here the element is in a div block I’m able to get all the locaters and do all other actions using Actions class but not able to drag and drop the element.

2.https://codepen.io/rjsmer/full/vvewWp

Here I’m trying to move the element from Frame one to Frame two but I’m not able to do so.

I’ve tried dragAndDrop(),ClickAndHold() methods,Searched so many solutions, watch videos on the same with no success.

package DragAndDropPracticeFrame;

import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;

import static io.github.bonigarcia.wdm.DriverManagerType.CHROME;

public class DragDropFrame {
public static void main(String[] args) throws InterruptedException {
WebDriverManager.getInstance(CHROME).setup();
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get(“https://codepen.io/rjsmer/full/vvewWp”);
driver.switchTo().frame(“result”);
System.out.println(“Inside First Frame.”);
WebElement frameOne =
driver.findElement(By.cssSelector(“iframe.dragFrame.dragDrop”));
driver.switchTo().frame(frameOne);
System.out.println(“Inside Frame 3”);
WebElement elementOne = driver.findElement(By.id(“dragFrame-0”));
System.out.println(“First element found: ” + elementOne.getText());
Actions builder = new Actions(driver);
driver.switchTo().defaultContent();
System.out.println(“Inside main page”);
driver.switchTo().frame(“result”);
//System.out.println(“Switched to Frame First”);
WebElement frameThree =
driver.findElement(By.xpath(“//iframe[@class=’dropFrame dragDrop’]”));
Action action =
builder.clickAndHold(elementOne)
.moveToElement(frameThree)
.release(frameThree).build();

//driver.switchTo().frame(frameTwo);
//System.out.println(“Switched to frame 3”);
action.perform();

//driver.switchTo().defaultContent();
//builder.perform();

}
}

Another try :

WebDriverManager.getInstance(CHROME).setup();
WebDriver driver = new ChromeDriver();
driver.get(“https://codepen.io/rjsmer/full/vvewWp”);
driver.switchTo().frame(0);
WebElement frameOne = driver.findElement(By.xpath(“//iframe[@class=’dragFrame dragDrop’]”));
WebElement frameTwo = driver.findElement(By.xpath(“//iframe[@class=’dropFrame dragDrop’]”));
driver.switchTo().frame(frameOne);
// identify element in first frame
WebElement elementOne = driver.findElement(By.id(“dragFrame-0”));

// Use Actions class for tap and hold
Actions actions = new Actions(driver);
Actions action = actions.clickAndHold(elementOne);
actions.build();
action.perform();

// switch to the second frame
driver.switchTo().frame(frameTwo);

// move element to another frame
WebElement elementTwo = driver.findElement(By.xpath(“//body[@class=’frameBody dropFrameBody’]”));
Actions actions2 = new Actions(driver);
Actions action2 = actions2.moveToElement(elementTwo);
actions2.release(elementOne);
actions2.build();
action2.perform();

Expected: The element should move to Frame 3 Actual: Nothing happened.

I am wondering if there is a way to know how many threads JMeter can support for a given machine configuration? Currently, I am working toward a task that requires me to check how many VMs I need to support different API threads.

I’ve looked in http://products.prqa.com/Unix/Linux/QAC_PRQAF/QAC-9.4.1-ReleaseNotes.pdf and it doesn’t feature. Any ideas where this is defined? It’s also not defined in the PRQA framework.
Update:
This is for MISRA compliance.

I’m trying to send nested JSON through Cucumber data table. I have the following scenario, I have tried Scenario Outline too but it didn’t resolve the issue.
Scenario: provider edits new productWorkingDate
Given productWorkingDates is edited with following fields
| id | productId | fromDate | toDate | name | strictHours | maxUsedTicketsQuantity | errorCode |
| bpvjPBpJ | WaNX2QOd | 2022-07-01 | 2022-12-01 | Test55 | false | 0 | 0 |
And TimeSlots is edited with following fields
| dayOfWeek | startTime | endTime | duration | quantity | usedQuantity | active |
| Sunday | 14:00:00 | 15:00:00 | 02:00:00 | 0 | 0 | true |
| Monday | 14:00:00 | 15:00:00 | 02:00:00 | 0 | 0 | true |

Then verify status code is 200

and I have the following step definition
@And(“^TimeSlots is edited with following fields$”)
public void timeslotsIsCreatedWithFollowingFields(List<Map<String, String>> expectedTimeSlots) {
TimeSlots timeSlots = new TimeSlots();

for(int i = 0; i < expectedTimeSlots.size(); i ++) {
timeSlots.setDayOfWeek(expectedTimeSlots.get(i).get(“dayOfWeek”));
timeSlots.setStartTime(expectedTimeSlots.get(i).get(“startTime”));
timeSlots.setEndTime((expectedTimeSlots.get(i).get(“endTime”)));
timeSlots.setDuration(expectedTimeSlots.get(i).get(“duration”));
timeSlots.setQuantity(Integer.parseInt(expectedTimeSlots.get(i).get(“quantity”)));
timeSlots.setUsedQuantity(Integer.parseInt(expectedTimeSlots.get(i).get(“usedQuantity”)));
timeSlots.setActive(Boolean.parseBoolean(expectedTimeSlots.get(i).get(“active”)));

}

Actual output is :
{
“productWorkingDate”: {
“id”: “bpvjPBpJ”,
“productId”: “WaNX2QOd”,
“fromDate”: “2022-07-01”,
“toDate”: “2022-12-01”,
“name”: “Test55”,
“strictHours”: false,
“timeSlots”: [
{
“id”: “Wlqb8XOb”,
“productWorkingDateId”: “bpvjPBpJ”,
“dayOfWeek”: “Monday”,
“startTime”: “14:00:00”,
“endTime”: “15:00:00”,
“duration”: “02:00:00”,
“quantity”: 0,
“usedQuantity”: 0,
“active”: true,
“deletedAt”: null
}
],
“deletedAt”: null,
“maxUsedTicketsQuantity”: 0,
“errorCode”: 0
},
“maxUsedTicketsQuantity”: 0,
“error”: null,
“errorCode”: 0
}

Expected output is :
{
“productWorkingDate”: {
“id”: “bpvjPBpJ”,
“productId”: “WaNX2QOd”,
“fromDate”: “2022-07-01”,
“toDate”: “2022-12-01”,
“name”: “Test55”,
“strictHours”: false,
“timeSlots”: [
{
“id”: “4lrn8old”,
“productWorkingDateId”: “bpvjPBpJ”,
“dayOfWeek”: “Sunday”,
“startTime”: “14:00:00”,
“endTime”: “15:00:00”,
“duration”: “02:00:00”,
“quantity”: 0,
“usedQuantity”: 0,
“active”: true,
“deletedAt”: null
},
{
“id”: “dOnz85OV”,
“productWorkingDateId”: “bpvjPBpJ”,
“dayOfWeek”: “Monday”,
“startTime”: “14:00:00”,
“endTime”: “15:00:00”,
“duration”: “02:00:00”,
“quantity”: 0,
“usedQuantity”: 0,
“active”: true,
“deletedAt”: null
}
],
“deletedAt”: null,
“maxUsedTicketsQuantity”: 0,
“errorCode”: 0
},
“maxUsedTicketsQuantity”: 0,
“error”: null,
“errorCode”: 0
}

I am new to JMeter + WebDriver + Java. JavaScript code is working as expected for screenshot. Due to recent upgrade of Java, we are moving from JavaScript to Java.
Below is the code. Can you please help with it?
import org.openqa.selenium.By;
import org.openqa.selenium.support.events.EventFiringWebDriver;
import org.openqa.selenium.support.ui;
import java.io.File;
import org.apache.commons.io.FileUtils;
import Java.awt.Robot;
import java.awt.image.BufferedImage;

WDS.sampleResult.sampleStart();

WDS.browser.get(“https://www.google.com/”);
Thread.sleep(10);

TakesScreenshot ts = (TakesScreenshot)WDS.browser;
File srcFile = ts.getScreenshotAs(OutputType.FILE);
File destFile = new File(“/Users/****/desktop/screenshot.png”);
try{
FileUtils.copyFile(srcFile, destFile);
} catch (IOException e) {
e.printStackTrace();
}

WDS.sampleResult.sampleEnd();

Also I tried below code
File mFile = ((TakesScreenshot)WDS.browser).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(mFile, new File(“output/” + WDS.name + “-” + WDS.parameters + “.png”));

Error message:
2022-05-03 11:28:51,641 ERROR c.g.j.p.w.s.WebDriverSampler: Sourced file: inline evaluation of: “import org.openqa.selenium.By; import org.openqa.selenium.support.events.EventFi . . . ” : Typed variable declaration : Class: TakesScreenshot not found in namespace : at Line: 14 : in file: inline evaluation of: “import org.openqa.selenium.By;
import org.openqa.selenium.support.events.EventFi . . . ” : TakesScreenshot in inline evaluation of: “import org.openqa.selenium.By;
import org.openqa.selenium.support.events.EventFi . . . ” at line number 14