Post Content Source: Read MoreÂ
Development
Post Content Source: Read MoreÂ
The rapid evolution of Large Language Models (LLMs) and conversational assistants necessitates dynamic, scalable, and configurable conversational datasets for training…
Aligning large language models (LLMs) with human expectations without human-annotated preference data is an important problem. In this paper, we…
NuMind is an innovative tool designed to facilitate creation of custom natural language processing (NLP) models through an interactive teaching…
Haize Labs has recently introduced Sphynx, an innovative tool designed to address the persistent challenge of hallucination in AI models.…
Music generation models have emerged as powerful tools that transform natural language text into musical compositions. Originating from advancements in…
Generative artificial intelligence (AI) models have opened up new possibilities for automating and enhancing software development workflows. Specifically, the emergent…
The field of generative AI is increasingly focusing on creating models tailored to specific industries, enhancing performance in areas such…
With last month’s blog, I started a series of posts that highlight the key factors that are driving customers to…
Drag and Drop not working..as my drag and drop area not having ‘Frames’ i didn’t use switchTo() here.
Actions action= new Actions(driver);
//driver.switchTo().frame(0);
WebElement drag= driver.findElement(By.xpath(“//div[contains(text(),’GEO’)]”));
WebElement drop= driver.findElement(By.xpath(“//div[@placeholder=’Drag and Drop the subjects which needs evaluation.’]”));
//action.doubleClick(drag);
Thread.sleep(3000);
action.dragAndDrop(drag, drop).perform();
Thread.sleep(3000);
Can anyone please help?
I am trying playwright and try to automate login feature. I have page classes, test classes and separate action class to write common actions like click,enter inputs.
My common action class
import { expect, Locator, Page } from “@playwright/test”
export default class Actions {
page:Page;
constructor(page:Page) {
this.page = page ;
}
public async enterInput(value:string,element:Locator) {
element.fill(value);
await this.page.waitForTimeout(5000);
}
public async clickButton(element:Locator) {
element.click();
await this.page.waitForTimeout(5000)
}
}
My login.page.ts class
import { Locator, Page, expect } from “@playwright/test”;
import Actions from “../common/actions”;
import * as path from “../xpaths/xpath.json”
import fs from ‘fs’;
export default class LoginPage {
page: Page;
action:Actions;
inputUsername:Locator;
inputPassword:Locator;
btnLogin:Locator;
errorText:Locator;
constructor(page:Page) {
this.page = page ;
this.action=new Actions(page);
const pathsxData = fs.readFileSync(“json path here”, “utf-8”);
const pathsx = JSON.parse(pathsxData);
this.inputUsername = this.page.locator(path.usernameInput);
this.inputPassword = this.page.locator(path.passwordInput);
this.btnLogin = this.page.locator(path.loginBtn);
this.errorText=this.page.locator(path.loginError)
}
public async login(username:string,password:string)
{
this.action.enterInput(username,this.inputUsername);
this.action.enterInput(password,this.inputPassword);
await this.action.clickButton(this.btnLogin);
}
public async successLogin(username:string,password:string,title:string){
this.login(username,password);
await expect(this.page).toHaveTitle(title);
}
public async invalidLogin(username:string,password:string,error:string){
this.login(username,password);
await expect(this.errorText).toHaveText(error);
}
public async emptyLogin(username:string,password:string,error:string){
this.login(username,password);
await expect(this.errorText).toHaveText(error);
}
}
My logintest.spec.ts
import { test , expect} from “@playwright/test”
import LoginPage from “../pages/login.page”
import * as data from “../testdata/testdata.json”
test.describe(‘Login Test’, () =>{
let login:LoginPage;
test.beforeEach(async({page}) =>{
await page.goto(“My Url”);
await page.waitForTimeout(5000)
login = new LoginPage(page);
});
test(‘invalid login-username/password both incorrect’, async () => {
login.invalidLogin(data.invalid_username,data.invalid_password,data.invalid_error);
});
test(’empty username/password login’, async()=>{
login.invalidLogin(data.invalid_username,data.invalid_password,data.invalid_error);
});
test(‘successfully login to the system’ , async () => {
login.successLogin(data.username,data.password,data.dashboard_title);
});
});
Whenever I execute the code always getting Target Closed error.Below is the error
Error: locator.fill: Target closed
=========================== logs ===========================
waiting for locator(‘xpath=//input[contains(@id,’outlined-basic’) and contains(@type,’text’)]’)
============================================================
at ..commonactions.ts:16
14 |
15 | public async enterInput(value:string,element:Locator) {
> 16 | element.fill(value);
| ^
17 | await this.page.waitForTimeout(5000);
18 | }
But when I execute code without using action class like below code executes successfully.
import { test , expect} from “@playwright/test”
import LoginPage from “../pages/login.page”
import * as data from “../testdata/testdata.json”
test.describe(‘Login Test’, () =>{
let login:LoginPage;
test.beforeEach(async({page}) =>{
console.log(page.url)
login = new LoginPage(page);
});
test(‘invalid login-username/password both incorrect’, async ({page}) => {
page.goto(“http://192.168.0.127/ussd_qa/login”);
await page.waitForTimeout(5000);
await login.inputUsername.fill(data.username);
await page.waitForTimeout(5000);
await login.inputPassword.fill(data.password);
await page.waitForTimeout(5000);
await login.btnLogin.click();
await page.waitForTimeout(5000);
await expect(login.errorText).toHaveText(data.invalid_error);
});
});
Can someone explain what is wrong here?
Overview of the Incident: What Went Wrong and Why? How Does Rigorous Software Testing Help Avoid Such Issues? Why Partner with Tx for Software Testing? Security Testing and Audits Summary Imagine a scenario: a software company’s development team is at the finish line of completing the code and pushing it to production. They spent countless … Continue reading “How Software Testing Failures Led to a Global Crisis: Key Takeaways”
The post How Software Testing Failures Led to a Global Crisis: Key Takeaways first appeared on TestingXperts.
Network issues seem to occur at the worst possible times – use these Linux commands to get to the bottom…
Between the built-in Arc Max features and a handy extension, Arc browser is an AI powerhouse. Source: Latest newsÂ
I’ve used every open-source email client available. These are the best of the best. Source: Latest newsÂ
If you’re looking for a TV set that doubles as artwork, you have a new option. Source: Latest newsÂ
Running advanced LLMs like Meta’s Llama 3.1 on your Mac, Windows, or Linux system offers you data privacy, customization, and…
AI can create unexpected problems for crafters. Here’s what to watch out for, and why it matters even if you…
More people use generative AI every day. Here are some of the intriguing things they’re doing. Source: Latest newsÂ