Development

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

I created a test script to sign in and sign out an application and tested the script with a single user.
The aggregate report shows average time as 72 secs for sign out for just 1 user. But when I manually sign out the application, it is getting done in 2 seconds itself.
Why is this?

Here is my script –
next=WDS.browser.findElement(pkg.By.xpath(“//button[contains(@class,’btn btn-sm btn-light border ml-3′)]”))

while(next.isEnabled()==true)
{
//java.lang.Thread.sleep(4000);

var wait19 =new org.openqa.selenium.support.ui.WebDriverWait(WDS.browser, 9000)
wait19.until(org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable(pkg.By.xpath(“//button[contains(@class,’btn btn-sm btn-light border ml-3′)]”))).click()

next=WDS.browser.findElement(pkg.By.xpath(“//button[contains(@class,’btn btn-sm btn-light border ml-3′)]”))
//WDS.log.info(WDS.browser.getPageSource())
if (!next.isEnabled()) {
WDS.log.info(‘Next button disabled’)
break
}
}

In my application, I need to visit total 300 pages and calculate time taken to traverse from first page to last.
But, when click on next button, it throws exception:
ERROR c.g.j.p.w.s.WebDriverSampler: element click intercepted: Element <button _ngcontent-pde-c133=”” class=”btn btn-sm btn-light border ml-3″>…</button> is not clickable at point (226, 567). Other element would receive the click: <div _ngcontent-pde-c109=”” class=”overlay ng-tns-c109-11 ng-trigger ng-trigger-fadeIn ng-star-inserted ng-animating” style=”background-color: rgba(0, 0, 0, 0.8); z-index: 99999; position: fixed;”>…</div>
How do I resolve it?

I’m trying to compare two strings using this code in a switch statement:
case “medStepOne”:
WebEligibilityMedFirst.SelectOptions(p0);
if (!p0.Equals(“failOne”) || !p0.Equals(“failTwo”) || !p0.Equals(“failThree”) || !p0.Equals(“failFour”))
{
WebEligibilityMedSecond.SelectOptions(p0);
}
break;

The string is definitely “failOne” so I believe that the code should bypass the if statement but it does not.

I have copied some text from the website and then pasted it into the text file. And also I did the same thing to paste the second text using the “Append To File” keyword.
I want to paste the first text in the first row and the second text in the next row. How could I do that?
This is what I have so far,
*** Test Cases ***
TC_01
Open Browser ${BASE_URL} gc
EXECUTE JAVASCRIPT window.scrollTo(200,400)
sleep 5s

${Text} = Get Text xpath=//div[2]/md-card/header/h2
${Value} = Get Text css=.recommended-size
createFile C:/MyProjects/Records/File.txt ${Text}
Append To File C:/MyProjects/Records/File.txt ${Space}
Append To File C:/MyProjects/Records/File.txt ${Value}

log to console success
sleep 2s

I got the result as the above screenshot, and what I want to do is, I want to paste the “1km” on the next line.
Please help to solve this issue. Any guidance and advice will be greatly appreciated!

This blog discusses the significant role of AI-driven intelligent systems in transforming data management. It emphasizes how ML and NLP are pivotal in enhancing data accuracy and enabling real-time decision-making. By automating processes and improving predictive analytics, AI facilitates efficient and informed decisions across different sectors. Examples from healthcare and e-commerce illustrate AI’s effectiveness in areas like fraud detection and enhancing customer experiences. Adopting intelligent systems can help businesses optimize operations and maintain a competitive edge in a tech-driven world.
The post Transforming Data Management: The Impact of AI-Driven Intelligent Systems first appeared on TestingXperts.

This is a lightly-edited excerpt from a longer blog post that you’ll find here. I recommend you read it too, but if you’re short on time, here’s the core of it. If you care about understanding the status of your product, you’ll probably care about testing it. You’ll want testing to find out if the product you’ve got is the product you want. If you care about that, you need … Read more

Numerous studies have demonstrated the physical and mental health benefits provided by holidays and vacation time, which help employees maintain…