Libraries & Frameworks

I have a MacBook m2 and I want to test with the Safari web browser. I received this message when I compiled my small test with Intellij idea ce.
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
My code is:
public class automateBrowsers {
public static void main(String[] args) {

WebDriverManager.safaridriver().setup();
WebDriver driver = new SafariDriver();

}
}

I already allow remote automation from Safari develop. So any help, please?

I am trying to click a button through webdriver. After inspecting the button element it highlights to the following:

XPath:

/html/body/div/div/main/div/div[2]/div/div[2]/table/tbody/tr/td[4]/form/button

This is my code:

WebDriver driver= new FirefoxDriver(); driver.get(“Website link”);
driver.findElement(By.id(“email”)).sendKeys(“xyz”);
driver.findElement(By.id(“password”)).sendKeys(“xyz”);
driver.findElement(By.xpath(“//*[text()=’Log in’]”)).click();
driver.findElement(By.xpath(“//button[text()=’CANCEL’]”)).click();

But, when I try to run the code, it doesn’t click the button.
Can anyone help me solve this? Would be a great help

In my project, we have a module called Reporting which covers graphs and charts.
It’s basically a dashboard on the homepage of the website with multiple graphs and charts (after inspecting them they are seen to be made of <CANVAS & <SVG tags
They are representing Data from a DataSource.
Manual Test Cases defined are validating that the data represented by the graphs and charts are correct in 2 areas.

Quantification – Value represented in graph and chart
Quality – visual design of chart and graph

How to approach test automation of such test cases? Can we achieve 100% automation in such modules?

Test Guild – Automation Testing Tools Community
9 Ways AI Improves Software Testing
I recently co-hosted a webinar, with Blinq.io to delve into the impact of intelligence (AI) on software testing practices and nine way AI can improve software testing. Cool stuff! During the session, Tal Barmeir and Guy Arieli seasoned quality assurance (QA) practitioners, shared their perspectives on leveraging AI to enhance team skills. Our conversation was
You’re reading 9 Ways AI Improves Software Testing, originally posted on Test Guild – Automation Testing Tools Community – and copyrighted by Joe Colantonio

A Laravel package to filter, search and sort models with ease while fetching from database. Source: Read More 

I use java mail API in selenium automation script to verify email confirmations. The scripts will be executed by different team members. I got this error, when someone tries to run from other IP address.

Web login required: https://support.google.com/mail/answer/78754

while using “pop3” protocol
and

Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure)

while using imaps protocol

I am using seleniumGrid with chromedriver for running a series of automated testcases with TestNG and Selenium
The thing is that there are several tests that launch a new chrome window that has a “data:” in the address bar and freezes for like 30 seconds before starting the actual test.
I have updated chromedriver to match the version of Chrome as it is indicated in several places and nothing has changed.
Could you give a suggestion on how to avoid this delay?

An Overview of Application Performance Monitoring (APM) Why is APM (Application performance monitoring) Important for Businesses? Key Metrics Tracked by Application Performance Monitoring 6 Use Cases of Application Performance Monitoring How can Tools like Datadog Assist with Application Performance Monitoring? Why Partner with Tx for Application Performance Monitoring? Summary Everyone once in a while in … Continue reading “The Significance of Application Performance Monitoring for Businesses”
The post The Significance of Application Performance Monitoring for Businesses first appeared on TestingXperts.

I was applying for QA position and the SDET asked me this question:

How do you test a backend API?

In the interview.

I wasn’t sure I answered it correctly. Just wondering if I can get some input from someone.

In my Selenium+Java automation framework, I need to open a .txt file or any other extension file and then see if the text is in a particular format. Now, I need to see if all lines are in this format and also, say in line 2, from substring (7,10) is 2000. Now, is there any method in FileUtils API?
I can open the file and assert that it exists. I am not able to validate File content. I need to do this as a part of my Automation project. this is indeed the purpose of my project to validate all file format contents.
Like:
0000000TEst 123 234 TEST22 refreence 0002343
00000002000 2343 23343 TEST22000000000000000000
000000003534 3434 34343 3434 343 343 TEst 0000000 000 000 001

Update in response to answers:
Thanks! this is very helpful, i will use this method to verify all the file formats with regex.
Also, once i validate the format, then i will validate some substrings. Now, i have the expected result of Substring stored in String line2Value = “2000”;
if(line1.substring(7,10).equals(line2Value)){

// syso(“This is correct…..”
}

Now, I have such kind of a file in which some section of records, some regex repeats n number of times.
{1:TES001}{2:TEST002}{3:
:03:192sscE8wre
:04:TESTLIne
:05C:23434/23423
:06:/
:07:343434,434343//3434343434
:89:?This is test line / EXTRA TEXT LINE
-}
My file will have hundreds of these sections, that all start from {1:… and end with -89 }..

how i can check not just 1 section, but all of these groups are in the same format :/

I am Unable to launch a website in firefox browser using firefox Driver config.
Jmeter version : 5.5
Firefox version installed on system : 110.0
. Below are the jmeter logs,
2023-02-16 14:55:35,984 ERROR o.a.j.t.JMeterThread: Error calling threadStarted
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: Expected browser binary location, but unable to find binary in default location, no ‘moz:firefoxOptions.binary’ capability provided, and no binary flag set on the command line
Host info: host: ‘KESHAVSS298-UB’, ip: ‘192.168.2.21’
Build info: version: ‘4.7.2’, revision: ‘4d4020c3b7’
System info: os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_241’
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: false, browserName: firefox, moz:debuggerAddress: true, moz:firefoxOptions: {args: [], profile: UEsDBBQACAgIAPF2UFYAAAAAAAA…}, proxy: Proxy(system)}], desiredCapabilities=Capabilities {acceptInsecureCerts: false, browserName: firefox, moz:debuggerAddress: true, moz:firefoxOptions: {args: [], profile: UEsDBBQACAgIAPF2UFYAAAAAAAA…}, proxy: Proxy(system)}}]
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:148) ~[selenium-remote-driver-4.7.2.jar:?]
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:106) ~[selenium-remote-driver-4.7.2.jar:?]
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67) ~[selenium-remote-driver-4.7.2.jar:?]
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156) ~[selenium-remote-driver-4.7.2.jar:?]
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167) ~[selenium-remote-driver-4.7.2.jar:?]
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142) ~[selenium-remote-driver-4.7.2.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:535) ~[selenium-remote-driver-4.7.2.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:228) ~[selenium-remote-driver-4.7.2.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:156) ~[selenium-remote-driver-4.7.2.jar:?]
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:130) ~[selenium-firefox-driver-4.7.2.jar:?]
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:126) ~[selenium-firefox-driver-4.7.2.jar:?]
at com.googlecode.jmeter.plugins.webdriver.config.FirefoxDriverConfig.createBrowser(FirefoxDriverConfig.java:36) ~[jmeter-plugins-webdriver-4.7.2.jar:?]
at com.googlecode.jmeter.plugins.webdriver.config.FirefoxDriverConfig.createBrowser(FirefoxDriverConfig.java:15) ~[jmeter-plugins-webdriver-4.7.2.jar:?]
at com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig.getPreparedBrowser(WebDriverConfig.java:215) ~[jmeter-plugins-webdriver-4.7.2.jar:?]
at com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig.threadStarted(WebDriverConfig.java:146) ~[jmeter-plugins-webdriver-4.7.2.jar:?]
at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:797) ~[ApacheJMeter_core.jar:5.5]
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:993) ~[jorphan.jar:5.5]
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:976) ~[jorphan.jar:5.5]
at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:765) ~[ApacheJMeter_core.jar:5.5]
at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:753) ~[ApacheJMeter_core.jar:5.5]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:264) ~[ApacheJMeter_core.jar:5.5]
at java.lang.Thread.run(Unknown Source) ~[?:1.8.0_241]
2023-02-16 14:55:35,984 ERROR o.a.j.t.JMeterThread: Error while processing sampler: ‘jp@gc – WebDriver Sampler1’.
java.lang.IllegalArgumentException: Browser has not been configured. Please ensure at least 1 WebDriverConfig is created for a ThreadGroup.
at com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler.sample(WebDriverSampler.java:63) ~[jmeter-plugins-webdriver-4.7.2.jar:?]
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:651) ~[ApacheJMeter_core.jar:5.5]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:570) ~[ApacheJMeter_core.jar:5.5]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:501) ~[ApacheJMeter_core.jar:5.5]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:268) ~[ApacheJMeter_core.jar:5.5]
at java.lang.Thread.run(Unknown Source) ~[?:1.8.0_241]
2023-02-16 14:55:35,984 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-1

Also I have tried solutions from below link but no luck.
https://sqa.stackexchange.com/questions/44197/unable-to-launch-and-set-the-geckodriver-using-firefox-driver-config?newreg=a459140114d04c5da24c0e78d35c11a6

Please help.

Capacity testing is a type of performance testing used to determine how much workload a system can handle before its performance begins to degrade. This testing is crucial for understanding the limits of your application’s capacity and ensuring it can handle high levels of traffic or data. Knowing the capacity of a system helps in…
The post Capacity Testing: What is it, Why it is Important, Real-Life Examples of Capacity Tests appeared first on Software Testing Material.

Edge case testing is a crucial aspect of software quality assurance that focuses on examining the behavior of an application at the extreme boundaries of its functional parameters. These edge cases often consist of scenarios that occur at the outer limits of normal operating conditions, pushing the system to its extremes. Identifying and understanding these…
The post Edge Case Testing: A Comprehensive Guide appeared first on Software Testing Material.

I am trying to drag an element into another element using Selenium WebDriver but it’s not working. I tried all the solutions which I can find on internet but none of the solutions seems to be working for me.

WebElement sourceelement = driver.findElement(By.cssSelector(“XXX”));
WebElement destelement = driver.findElement(By.cssSelector(“YYY”));

Code1:-

Actions builder = new Actions( _controls.getDriver());
builder.dragAndDrop(sourceelement, destelement);

Code2:-

Actions builder = new Actions(_controls.getDriver());
Action dragAndDrop =
builder.clickAndHold(sourceelement).moveToElement(destelement).release(destelement).build();
Thread.sleep(2000);
dragAndDrop.perform()

Code3:-

Point coordinates1 = sourceelement.getLocation();
Point coordinates2 = destelement.getLocation();
Robot robot = new Robot();
robot.mouseMove(coordinates1.getX(), coordinates1.getY());
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseMove(coordinates2.getX(), coordinates2.getY());
robot.mouseRelease(InputEvent.BUTTON1_MASK);
Thread.sleep(2000);

Code4:-

final String java_script =
“var src=arguments[0],tgt=arguments[1];var dataTransfer={dropEffe” +
“ct:”,effectAllowed:’all’,files:[],items:{},types:[],setData:fun” +
“ction(format,data){this.items[format]=data;this.types.append(for” +
“mat);},getData:function(format){return this.items[format];},clea” +
“rData:function(format){}};var emit=function(event,target){var ev” +
“t=document.createEvent(‘Event’);evt.initEvent(event,true,false);” +
“evt.dataTransfer=dataTransfer;target.dispatchEvent(evt);};emit(‘” +
“dragstart’,src);emit(‘dragenter’,tgt);emit(‘dragover’,tgt);emit(” +
“‘drop’,tgt);emit(‘dragend’,src);”;

((JavascriptExecutor)_controls.getDriver()).executeScript(java_script, sourceelement, destelement);
Thread.sleep(2000);

None of the above code is working for me. All the above runs without any error but drag and drop is not happening in the application. Anyone having any other solution ? Thanks.

Browser :- IE

Description of the class RedisCliWrapper
I have created a class called RedisCliWrapper where I have written many methods which call methods of the class redis.Redis. Substantially I have created a wrapper of the class redis.Redis. The reason of this choice is not important in this question.
The class RedisCliWrapper is written in the module redis_cli_wrapper.py. Below I show the class with only the method get_hgetall_value(), which is one of its many methods:
from redis import Redis

class RedisCliWrapper:

def __init__(self, redis_cli_instance : Redis):
self.__redis_cli_instance : Redis = redis_cli_instance

def get_hgetall_value(self, key):
return self.__redis_cli_instance.hgetall(key)

As the code shows when I create an instance of RedisCliWrapper I have to pass to the __init__() method an instance of the class redis.Redis.
Description of the test class RedisCliWrapperTestCase
To test the class RedisCliWrapper I have created a test module called test_redis_cli_wrapper.py. The content of the module is the following:
import unittest
from unittest import mock
import redis
from redis_cli_wrapper import RedisCliWrapper

class RedisCliWrapperTestCase(unittest.TestCase):

def setUp(self):
self.mock_redis_cli = mock.create_autospec(redis.Redis)
#self.mock_redis_cli = mock.Mock()
self.sut = RedisCliWrapper(self.mock_redis_cli)

def test_something_1(self):
self.mock_redis_cli.hgetall.return_value = {‘f1’: ‘value1’, ‘f2’: ‘value2’}
self.sut.get_hgetall_value(‘key1’)
self.mock_redis_cli.hgetall.assert_called_once_with(‘key1’)

def test_something_2(self):
self.mock_redis_cli.hgetall.return_value = {‘f21’: ‘value21’, ‘f22’: ‘value22’}
self.sut.get_hgetall_value(‘key2’)
self.mock_redis_cli.hgetall.assert_called_once_with(‘key2’)

def test_something_3(self):
self.mock_redis_cli.hgetall.return_value = {‘f1’: ‘value1’, ‘f2’: ‘value2’}
self.assertDictEqual({‘f1’: ‘value1’, ‘f2’: ‘value2’}, self.sut.get_hgetall_value(‘key1’))

if __name__ == ‘__main__’:
unittest.main()

In my real test module there are more than 200 tests, but here it is not important to show all the test methods (the same I have not showed all the methods of the class RedisCliWrapper).
How instantiate the attribute mock_redis_cli
In the previous test code the attribute mock_redis_cli is instantiated by the use the function mock.create_autospec():
self.mock_redis_cli = mock.create_autospec(redis.Redis)

If I execute the 3 tests, I obtain the following output:
> python test_redis_cli_wrapper.py

———————————————————————-
Ran 3 tests in 0.495s

OK

which shoes that the 3 tests are execute in 0.495 s (the execution of my real test code takes about 40 seconds).
If I instantiate the attribute mock_redis_cli by the following instruction:
self.mock_redis_cli = mock.Mock()

so without the use of the function mock.create_autospec(redis.Redis), the output of the execution of the 3 tests is the following:
> python test_redis_cli_wrapper.py

———————————————————————-
Ran 3 tests in 0.001s

OK

so the 3 tests are executed in only 1 ms (the execution of my real test code with the use of mock.Mock() instead of mock.create_autospec(redis.Redis) takes about 0.130 seconds).
My question
The time execution difference is enormous so in my context it is recommended to use mock.create_autospec(redis.Redis) or I can use the faster mock.Mock() instantiate instruction?

org.openqa.selenium.UnsupportedCommandException: This API is not supported anymore. See https://github.com/appium/appium/issues/15807
Build info: version: ‘4.7.0’, revision: ‘0a5b49d16f’
System info: os.name: ‘Mac OS X’, os.arch: ‘aarch64’, os.version: ‘14.5’, java.version: ‘17.0.11’
Driver info: io.appium.java_client.android.AndroidDriver$ByteBuddy$XSxgr1kt
Command: [be490095-e2e2-400d-807c-052b1607142e, launchApp {}]