Libraries & Frameworks

This is my code,
”’
import time

from selenium.webdriver.common.by import By

from selenium.webdriver import ActionChains

from selenium.webdriver.support import expected_conditions as EC

from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
num = str(datetime.datetime.now())
driver = webdriver.Firefox(executable_path=”C:\geckodriver.exe”)
driver.get(“https://my.eventbuizz.com/_super/analytics_requests”)
driver.maximize_window()
time.sleep(4)
driver.find_element_by_name(“email”).send_keys(“text”)
driver.find_element_by_name(“password”).send_keys(“text”)
driver.find_element_by_xpath(“//input[@value=’login’]”).click()
time.sleep(5)
driver.find_element_by_xpath(“//span[contains(text(),’Google Analytics’)]”).click()
time.sleep(2)
driver.find_element_by_xpath(“//span[contains(text(),’Analytics Requests’)]”).click()
ActionChains = ActionChains(driver)
time.sleep(2)

lists = driver.find_elements_by_xpath(“//*[@class= ‘gradeA’]/td[1]”)
for list_item in lists:
print(len(lists))
print(type(lists))
print(list_item.text)
output = list_item.text

driver.execute_script(“window.open(”);”)
driver.switch_to.window(driver.window_handles[1])
time.sleep(2)
driver.get(“https://my.eventbuizz.com/_super/organizerEvent/organizerEventList”)
time.sleep(2)
driver.find_element_by_xpath(“//input[@id=’event_name’]”).send_keys(output)
time.sleep(2)
driver.find_element_by_xpath(“//input[@value=’Search’]”).click()
time.sleep(2)
time.sleep(3)
driver.find_element_by_xpath(“//a[normalize-space()=’Auto Login’]”).click()
time.sleep(5)

driver.switch_to.window(driver.window_handles[2])
time.sleep(4)
driver.find_element_by_xpath(“//input[@name=’searchText’]”).send_keys(output)
driver.find_element_by_xpath(“//input[@id=’btn_sbt’]”).click()
time.sleep(2)
driver.find_element_by_xpath(“//div[@class=’img-center’]//a”).click()
time.sleep(3)
event_name = driver.find_element_by_xpath(“//input[@id=’event_name’]”).get_attribute(‘value’)
print(“Event Name = ” + event_name)
time.sleep(5)
a = driver.find_element_by_xpath(“//body[1]/section[1]/section[1]/form[1]/div[1]/div[3]/div[3]/div[2]/em[1]”).text
ab = a[8:]
print(“Event URl = ” + ab)

driver.execute_script(“window.open(”);”)
driver.switch_to.window(driver.window_handles[3])
time.sleep(2)
driver.get(“https://analytics.google.com/analytics/web/#/a213435779w295029133p256179771/admin”)
time.sleep(4)
email_phone = driver.find_element_by_xpath(“//input[@id=’identifierId’]”)
time.sleep(2)
email_phone.send_keys(“eb.march.eventbuizz2021@gmail.com”)
driver.find_element_by_id(“identifierNext”).click()
password = WebDriverWait(driver, 5).until(
EC.element_to_be_clickable((By.XPATH, “//input[@name=’password’]”)))
password.send_keys(“text”)
driver.find_element_by_id(“passwordNext”).click()
time.sleep(20)
# driver.find_element_by_xpath(“//span[@class=’ga-dialog-title-close’]”).click()
# time.sleep(6)
driver.find_element_by_xpath(“//span[contains(text(),’Create Property’)]”).click()
time.sleep(4)
driver.find_element_by_xpath(“//input[@id=’name’]”).click()
time.sleep(4)
driver.find_element_by_xpath(“//input[@id=’name’]”).send_keys(event_name)
time.sleep(4)

countries = driver.find_elements_by_css_selector(“[class=’menu-open-button-label-text’]”)
for country in countries:
if country.text == “United Kingdom”:
country.click()
break
time.sleep(2)
country_name = driver.find_elements_by_css_selector(“[class=’option-container ng-star-inserted’]”)
for count in country_name:
if count.text == “Denmark”:
count.click()
break

time.sleep(2)
amount_code = driver.find_elements_by_xpath(“//div[@class=’option-item-wrapper ng-star-inserted’]”)
for code in amount_code:
if code.text == “Danish Krone (DKK DKK)”:
code.click()
break

time.sleep(2)
driver.find_element_by_xpath(“//span[contains(text(),’Show advanced options’)]”).click()
time.sleep(2)
driver.find_element_by_css_selector(“[class=’mat-slide-toggle-thumb’]”).click()
time.sleep(2)
end = driver.find_element_by_xpath(“//label[contains(text(),’Website URL’)]”)
driver.execute_script(“document.body.scrollIntoView();”, end)
time.sleep(2)
driver.find_element_by_xpath(“//input[@type=’url’]”).send_keys(ab)

driver.find_element_by_xpath(“//label[@for=’mat-radio-8-input’]//span[@class=’mat-radio-label-content’]”).click()
time.sleep(2)
driver.find_element_by_xpath(“//span[contains(text(),’Next’)]”).click()
time.sleep(2)

driver.find_element_by_xpath(“//label[@for=’mat-radio-2-input’]//span[@class=’mat-radio-label-content’]”).click()

time.sleep(3)
driver.find_element_by_xpath(“//label[@for=’mat-checkbox-2-input’]//span[@class=’mat-checkbox-inner-container’]”).click()
time.sleep(2)
driver.find_element_by_xpath(“//span[normalize-space()=’Create’]”).click()
time.sleep(20)
driver.switch_to.frame(“galaxyIframe”)
time.sleep(5)
track = driver.find_element_by_xpath(“//div[@class=’_GACjb’]”).text
print(print(“Tracking ID = ” + track))

driver.switch_to.default_content()
time.sleep(2)
driver.find_element_by_xpath(“//mat-icon[contains(text(),’arrow_back’)]”).click()
time.sleep(2)
driver.find_element_by_xpath(“//span[contains(text(),’View Access Management’)]”).click()
time.sleep(8)
driver.find_element_by_xpath(“//button[@aria-label=’Add access to new users’]//span[@class=’mat-button-wrapper’]”).click()
time.sleep(3)
driver.find_element_by_xpath(“//button[normalize-space()=’Add users’]”).click()
time.sleep(3)
driver.find_element_by_id(“mat-chip-list-input-0”).send_keys(
“analytics47@api-project-770804776074.iam.gserviceaccount.com”)
time.sleep(3)
driver.find_element_by_xpath(“//span[normalize-space()=’Add’]”).click()
time.sleep(5)
driver.find_element_by_xpath(“//mat-icon[normalize-space()=’close’]”).click()
time.sleep(3)
driver.find_element_by_xpath(“//span[contains(text(),’View Settings’)]”).click()
time.sleep(3)
view_id = driver.find_element_by_css_selector(“[class=’content view-id’]”).text
print(“View ID =” + view_id)
time.sleep(3)
driver.execute_script(“window.open(”);”)
driver.switch_to.window(driver.window_handles[4])
time.sleep(2)
driver.get(“https://my.eventbuizz.com/_admin/add_google_analytics”)
time.sleep(4)
driver.find_element_by_xpath(“//input[@placeholder=’Google analytics email’]”).clear()
time.sleep(2)
driver.find_element_by_xpath(“//input[@placeholder=’Google analytics email’]”).send_keys(
” analytics47@api-project-770804776074.iam.gserviceaccount.com”)
time.sleep(1)
driver.find_element_by_xpath(“//input[@placeholder=’Google Analytics Code’]”).clear()
time.sleep(2)
driver.find_element_by_xpath(“//input[@placeholder=’Google Analytics Code’]”).send_keys(track)
time.sleep(1)
driver.find_element_by_xpath(“//input[@placeholder=’Google profile ID’]”).clear()
time.sleep(2)
driver.find_element_by_xpath(“//input[@placeholder=’Google profile ID’]”).send_keys(view_id)
time.sleep(2)
driver.find_element_by_xpath(“//input[@class=’save-event’]”).click()
time.sleep(4)
driver.find_element_by_xpath(“//a[@class=’btn btn-sm log-out text-right’]”).click()
time.sleep(3)
driver.switch_to.window(driver.window_handles[5])
time.sleep(4)
driver.find_element_by_xpath(“//label[normalize-space()=’Statistics’]”).click()
time.sleep(2)
driver.find_element_by_xpath(“//a[normalize-space()=’Accept all cookies’]”).click()

time.sleep(5)
driver.switch_to.window(driver.window_handles[3])
driver.find_element_by_xpath(“//md-icon[@md-font-icon=’realtime-icon’]”).click()
time.sleep(3)
driver.find_element_by_xpath(“//span[@class=’ga-nav-link-label ga-nav-link-no-icon’]”).click()
time.sleep(3)
print(“************************ Google analytics added successfully **************************** “)

with open(‘Text.txt’, mode=’w’) as f:
f.write(“Event_name” + ” ” + “Event_Tracking_ID” + “n”)
for post in event_name:
f.write(post)
f.write(” “)
for post1 in track:
f.write(post1)
f.write(“n”)
driver.switch_to.window(driver.window_handles[0])
”’

I have a multi module application “Project A”. This application is hosted in clustered app nodes using tomcat as web server. We are using Spring, Web Services as primary among many other technologies to build this.

For doing the API Automation i have another project “Project B” which test all the public API of “Project A” using rest-assured.

Both the “Project A” and “Project B” are distinctly different and hosted in different GIT location. We do the build and test using Jenkins.

Now my requirement is to get code coverage of “Project A” using “Project B”.

What I have Done till now:

A. I have installed jacoco-agent.jar in each of my app node and put the “JACOCO-ARGS” in the web server start up script.

JACOCO_OPTS=”-javaagent:/opt/itop/jacoco-agent.jar=destfile=/opt/itop/jacoco-
it.exec,output=file,append=true,jmx=true”

JAVA_OPTS=”${JAVA_OPTS} ${JACOCO_OPTS}”

B. We usually keep one node on only while looking for code coverage.

What I am getting now:

I am getting the jacoco-it.exec file generated but with very less coverage. With all the API passing i am getting only 3% coverage at max. Where as by doing manual testing we are getting more than 50%.

What I am looking for:

Is there any other step which I am missing here?
How to get max code coverage for this set up?
What is the standard I need to follow while looking for code coverage?

White box testing is essential in software engineering, offering an in-depth view of internal code operations to enhance software quality and stability. This blog outlines the various types of white box testing, their importance in identifying and fixing code errors early in the development process, and the latest tools for 2024, such as JUnit and Selenium. White box testing ensures comprehensive code coverage and supports the development of robust, efficient applications by allowing detailed inspection and modification of the code.
The post Why is White Box Testing Essential in Software Engineering? first appeared on TestingXperts.

I am currently working on updating regression test suite. I would like to add some simple test at the beginning of the regression suite to make sure it is still behaving correctly and all the basic functionality still works (can perform basic operations and also it is able to connect to the database or other services) before proceed with full regression test suite. These test would not be specialized based on type of changes which were made to the software, but would only cover specific subset of regression tests, which would be the same for every new build. They would cover broad range of functionality. Would these test be considered more as sanity tests or smoke tests? Thank you.

This might be a trivial question/answer, however I would like to know if there is a way that I could store an element locator in a variable and then reuse it same as it while working with Selenium and Page Object Pattern.
In my previous work I used to write automation test in Visual Studio and I used Selenium Web-driver along with Page Object Pattern approach. During my work on the Page Objects and later component, I could declare all selectors by FindBy annotation and then reuse it for the purpose of future tests. I have just started my adventure with Playwright and I was wondering if I could achieve same approach. So far all examples in web showed that each time when you have an element selector you perform already an action on it.
Lets say that I have a Page Object Class called “Home Page”. On this page there is a “Submit” button. I would like to get location of this button and store in a variable so I can reuse it in the future. How can I achieve similar out which I used with FindBy annotation?
So instead of having common approach such as -> await page.click(‘button’);
I would like to have something which will look like this -> const submitButton= [location of button tag];
Thanks in advance for any guidance.

When I try to take a screenshot, I added a scroll so that it can take a significant screenshot and not only the header. Right now, the picture is still taken from the header/top of the page.
Am I doing something wrong?
Screenshot method :
public void ScreenShot() {
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript(“scroll(0,450);”);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(“yyyy-MM-dd HH_mm_ss”);
LocalDateTime now = LocalDateTime.now();
String destDir = System.getProperty(“user.dir”) + “/” + “test-output/ScreenShots”;
String FileName = “SoftAssertScreenshot_” + dtf.format(now) + “.png”;
String DestFile = destDir + “/” + FileName;
File file = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
File ScreenshotName = new File(DestFile);
try {
FileUtils.copyFile(file, ScreenshotName);
} catch (IOException e) {
e.printStackTrace();
}
Reporter.log(“</br><font color=’#73a9d0′>***************Screen Of the error****************</font>”);
Reporter.log(“</br><img id=’ErrorResult’ src='” + DestFile + “‘ style=’width:600px’/>”);
}

The chrome browser version is Version 115.0.5790.171 and downloaded chrome driver version is 114
[![enter image description here][1]][1]
as driver version 115 is not available.
I’m using the x-path and checked the x-path is correct or not in developer tool under console section it is correct. Even tried absolute path given by Automation Tester but still getting as No such element is found
[![enter image description here][2]][2]
[![enter image description here][3]][3]
This x-path is getting due to chrome browser version is 115 and chrome driver version is 114 using due to unavailable.
Could someone please help me
[1]: https://i.stack.imgur.com/RnSVN.png
[2]: https://i.stack.imgur.com/ydrhs.png
[3]: https://i.stack.imgur.com/hXedl.png

Assumptions, imagine we are selling a software API:

a “system test” verifies that a system works by calling it’s public interface e.g. assert(init()==true) or assert(MY_PI > 2 && MY_PI <= 10)
a set of “unit tests” verifies the public interface of implementation details (assuming OOP: all public methods and fields) does what is expected
an “integration test” is something in between and is not really important for the question.

What I wonder is what is the term/s for more localized whitebox tests :

private methods(and if You cluster that with “unit”, what about lambdas?)
assert()*s peppered inside methods/functions.

* – referring to C++ asserts which compile to no operation in release code; not python asserts which are beautiful ifs

I created a sample Selenium Webdriver test using java and maven and pushed it out to my gitlab repository. Then I created a new pipeline to run the automated tests. This is my first time running a test on the pipeline so I followed some instructions online. The issue I’m having is that the test fails because of this error: (unknown error: DevToolsActivePort file doesn’t exist)
I saw some few questions regarding this too and tried to add those solutions but still getting that error. Used this link where I added those arguments.
WebDriverException: unknown error: DevToolsActivePort file doesn’t exist while trying to initiate Chrome Browser
Not sure what I need to do to fix this error or how to run the test as a non-root user which can maybe be a workaround.
This is my yml file for the pipeline
# calling the docker image where chrome, maven, jdk are available to run the tests
image: markhobson/maven-chrome:jdk-11

# building the maven
build:
stage: build
script:
– mvn compile

# running the tests
test:
stage: test
script:
– mvn clean test

BaseTest class
@BeforeSuite
public void beforeSuite() {
WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
String runTime = null;

try {
InputStream input = BaseTest.class.getClassLoader().getResourceAsStream(“runSetup.properties”);
Properties properties = new Properties();
properties.load(input);
runTime = properties.getProperty(“runTimeOnLocal”);
} catch (IOException e) {
e.printStackTrace();
}

// if it’s true, that means running locally on my machine and open the webrowser
// if it’s false, that means it’s running on gitlab headless
if(runTime.equalsIgnoreCase(“TRUE”)) {
options.addArguments(“start-maximized”);
options.addArguments(“enable-automation”);
options.addArguments(“–no-sandbox”);
options.addArguments(“–disable-infobars”);
options.addArguments(“–disable-dev-shm-usage”);
options.addArguments(“–disable-browser-side-navigation”);
options.addArguments(“–disable-gpu”);
}
else if(runTime.equalsIgnoreCase(“FALSE”)) {
options.addArguments(“–disable-dev-shm-usage”);
options.addArguments(“–no-sandbox”);
options.addArguments(“–disable-gpu”);
options.setHeadless(true);
}

driver.set(new ChromeDriver(options));
Log.info(“Opening web application”);
driver.get().get(“https://demo.opencart.com/”);
}

I also put the link to my repo as this is a sample for me to review selenium (need to switch to master branch)
SeleniumReview

As healthcare evolves, digital transformation becomes crucial for enhancing patient care and operational efficiency. This blog highlights the top 10 digital transformations in healthcare trends for 2024, including artificial intelligence, mobile health technologies, big data, extended reality, and wearable medical devices. Discover how these innovations make healthcare more accessible and efficient and tailored to meet modern healthcare demands while ensuring data security and system integration.
The post Top 10 Digital Transformation in Healthcare Trends for 2024 first appeared on TestingXperts.

Cloud migration consulting is crucial for businesses looking to enhance operational efficiency, security, and scalability in the digital realm. The blog discusses how a cloud migration consultant is key in planning and executing a smooth transition to cloud platforms, utilizing deep expertise to optimize infrastructure and operations. From risk management to cost-effectiveness, consultants ensure a seamless integration of cloud technology, aligning it with long-term business goals. Their support mitigates risks, reduces costs, and minimizes downtime, paving the way for a successful digital transformation.
The post Why is Cloud Migration Consulting Important for Businesses? first appeared on TestingXperts.

I’m automating my Windows application.

I’m using Winapp driver and Java language for automation. I am capturing the web elements using UI Spy Tool.

My application is loading, still I can’t automate the login page.
I’m getting the following error:

My Code:

public class Reporter
{

private static WindowsDriver<WindowsElement> driver;

public static void main(String args[])
throws MalformedURLException, InterruptedException
{
DesiredCapabilities capabilities = new DesiredCapabilities();
String homePath = System.getenv(“USERPROFILE”);
capabilities.setCapability(“app”, homePath + “\AppData\Local\Apps\2.0\HHCZT7OJ.D37\61K3K288.OXH\base..tion_6e5be371fe594b2d_0001.0000_aad96dff3b16369b\”);
WindowsDriver Session = new WindowsDriver(new URL(“http://127.0.0.1:4723”), capabilities);

Assert.assertNotNull(Session);
Session.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

DesiredCapabilities Appcapabilities = new DesiredCapabilities();
Appcapabilities.setCapability(“app”, “Root”);
WindowsDriver AppSession = new WindowsDriver(new URL(“http://127.0.0.1:4723”), Appcapabilities);
Thread.sleep(5000);

WebDriverWait wait=new WebDriverWait(AppSession, 30);

AppSession.findElementByAccessibilityId(“txtUserName”).sendKeys(“r_nave”);
AppSession.findElementByAccessibilityId(“txtPassword”).sendKeys(“naveen”);
AppSession.findElementByAccessibilityId(“btnLogin”).click();
}

}

Error::

Jul 16, 2018 10:19:47 AM org.openqa.selenium.remote.ProtocolHandshake
createSession INFO: Detected dialect: OSS Jul 16, 2018 10:19:47 AM
org.openqa.selenium.remote.ProtocolHandshake createSession INFO:
Detected dialect: OSS Exception in thread “main”
org.openqa.selenium.NoSuchElementException: An element could not be
located on the page using the given search parameters. (WARNING: The
server did not provide any stacktrace information) Command duration or
timeout: 0 milliseconds For documentation on this error, please visit:
http://seleniumhq.org/exceptions/no_such_element.html Build info:
version: ‘3.5.3’, revision: ‘a88d25fe6b’, time:
‘2017-08-29T12:42:44.417Z’ System info: host: ‘ANTONYW10’, ip:
‘10.246.0.91’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version:
‘10.0’, java.version: ‘10.0.1’ Driver info:
io.appium.java_client.windows.WindowsDriver Capabilities [{app=Root,
javascriptEnabled=true, platformName=XP, platform=XP}] Session ID:
BB465F8F-3CE3-453C-99CB-BB517378A6B2
*** Element info: {Using=accessibility id, value=txtUserName}

Now it’s working for me that I put thread.sleep 20000

I want to compare 2 JDBC responses:

I have Source reponse from 1 JDBC request as below in table format:

(Source DB)JDBC Response response1:

(Target DB)JDBC Reponse 2:

I am saving the response as String in JDBC Request (in Result Variable Name)

Now how do I compare the values in each column and Print Pass when values match. Fail it when the values do not match.

Number of rows can change.

Need help with assertion code or any other way this can be achieved in Jmeter.

I have Integrated JIRA from testlink using REST API. I was also able to link the failed testcase to a bug in JIRA.

But while trying to create issue in testlink there is a validation happening for Version field.

Below are the fields required for creating issue in testlink.

Version

Version has to autopopulate with data. But not sure what data needs to be populated. Whenever I type in any data, it shows no match found and field becomes empty. Thereby, the form is not allowed to submit. Could you please let me know what data is needed for Version field.

Thanks,