0

I have created a test plan using Selenium/Webdriver in JMeter and trying to run the test plan using chrome driver in headless mode, unfortunately it didn't work. Please see the logs below for more information.

Logs :

2020-04-13 13:16:12,115 INFO c.g.j.p.w.s.WebDriverSampler: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/81.0.4044.92 Safari/537.36
2020-04-13 13:16:12,115 INFO c.g.j.p.w.s.WebDriverSampler: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/81.0.4044.92 Safari/537.36
2020-04-13 13:16:37,489 ERROR c.g.j.p.w.s.WebDriverSampler: element not interactable
  (Session info: headless chrome=81.0.4044.92)
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'sltubuntu-VirtualBox', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.3.0-46-generic', java.version: '11.0.6'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 81.0.4044.92, chrome: {chromedriverVersion: 81.0.4044.69 (6813546031a4b..., userDataDir: /tmp/.com.google.Chrome.uK8blq}, goog:chromeOptions: {debuggerAddress: localhost:42747}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(autodetect), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
Session ID: dfadc0d335251bb92243425ea7163d06
2020-04-13 13:16:38,411 ERROR c.g.j.p.w.s.WebDriverSampler: element not interactable

Script: Using Javascript

WDS.sampleResult.sampleStart()
WDS.browser.get('https://lifec.com/');
var username = WDS.args[0];
var password = WDS.args[1];
var msisdn = WDS.args[2];
WDS.log.info('username : ' + username);
WDS.log.info('password : ' + password);
WDS.log.info('msisdn : ' + msisdn);
WDS.log.info(WDS.browser.executeScript('return window.navigator.userAgent'));
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='username']")).sendKeys(username);
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='password']")).sendKeys(password);
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@value='Login']")).click();
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[text() = 'Search']")).click();
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id = 'cli']")).sendKeys(msisdn);
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='orderStatusId']/option[5]"));
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@value='Search']")).click();
WDS.browser.findElement(org.openqa.selenium.By.xpath("(//*[contains(text(),'Lead Generator')])[2]/following::*[6]")).click();
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@href='#orderSummary']")).click();
WDS.browser.findElement(org.openqa.selenium.By.id("userDropdown")).click();
var verifyUsername = WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(text()," + username + ")]"));
WDS.log.info('verifyUsername : ' + verifyUsername);
verifyUsername == username;
WDS.log.info('verifyUsername :: username -->' + verifyUsername + "==" + username);
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(text(),'Logout')]")).click();
WDS.sampleResult.sampleEnd();

Can anyone please help me to get out from it ??

0

JMeter works just fine, there is a problem with your test script itself.

You're getting ElementNotInteractableException which means that:

Thrown to indicate that although an element is present on the DOM, it is not in a state that can be interacted with.

I would recommend using Explicit Wait so your script would attempt to work with the element only when it is ready for that using i.e. ExpectedConditions.elementToBeClickable function, something like:

WDS.sampleResult.sampleStart()
WDS.browser.get('http://example.com')
var wait = new org.openqa.selenium.support.ui.WebDriverWait(WDS.browser, 10)
var conditions = org.openqa.selenium.support.ui.ExpectedConditions
wait.until(conditions.elementToBeClickable(org.openqa.selenium.By.linkText('More information...')))
WDS.sampleResult.sampleEnd()

More information: The WebDriver Sampler: Your Top 10 Questions Answered

| improve this answer | |
  • Do I need to add the wait.until with all the elements in my selenium script ? Should I share with you the whole script here for more information ?? – Rajan Apr 13 at 8:35
  • The errors I have recieved at var wait = new org.openqa.selenium.support.ui.WebDriverWait(WDS.browser, 10) : 2020-04-13 15:25:42,689 ERROR c.g.j.p.w.s.WebDriverSampler: TypeError: org.openqa.selenium.support.ui.WebDriverWait is not a function in <eval> at line number 6 2020-04-13 15:25:42,690 ERROR c.g.j.p.w.s.WebDriverSampler: TypeError: org.openqa.selenium.support.ui.WebDriverWait is not a function in <eval> at line number 6 2020-04-13 15:25:44,002 ERROR c.g.j.p.w.s.WebDriverSampler: TypeError: org.openqa.selenium.support.ui.WebDriverWait is not a function in <eval> at line number 6 – Rajan Apr 13 at 9:58
  • Hi, I have added the selenium script above. Please refer to the same and tell me where or how can I used the explicit time in the script. Thank you! – Rajan Apr 13 at 14:22
0

WebDriverSampler: element not interactable

This error means that the element you were targeting was found but it was not interactable. Does the error log say which element it was? It could be disabled for instances like:

  • Login button is disabled until a username and password is entered.

I would try putting a breakpoint and running it locally to figure out where exactly it breaks. The wait time could be the issue but it can also be something like the script entering an invalid username which causes the login button to be disabled and "not interactable".

| improve this answer | |
  • Hi, Login button is not disabled, its enabled if we are not entering the values in username and password field and second that the error logs I have shared above is exactly the same as i have got while running the test plan and it has been showing me the only one error that is element not intractable. – Rajan Apr 14 at 5:22
  • Right. The login button was just a guess. The main point I was trying to make was that you need to determine WHICH element is not interactable. Is it the username? the password? the login button? the search? How far is the script getting before it fails? Or is it failing immediately? – Eric Apr 16 at 19:01
  • It is failing immediately after the chrome maximize, and suppose if password is not intractable or if login button is not intractable then what should i have to do in that case ?? – Rajan Apr 16 at 19:16
  • Ok cool. If it is failing immediately then my assumption (which could be wrong) would be that the elements are loaded and present but are perhaps disabled until the page is fully loaded. Something you wouldn't really notice when testing manually. Solution to this would be to wait until the element is interactable. If its failing immediately after maximize() then its probably the username element. I'll edit my original comment and see if I can explain better. – Eric Apr 16 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.