The automator
The automator

Reputation: 87

Capybara ,MSEdgeDriver : Selenium::WebDriver::Error::JavascriptError: javascript error: arguments[0].matches is not a function

I am executing test case using ruby 2.7, Selenium -WebDriver 3.142.7, Capybara 3.35.3 ,MSEdgeDriver 91.0.864.48,Cucumber 5.3.0. . My page is being killed just after loading. Please find below logs.

Starting MSEdgeDriver 91.0.864.48 (27d934e7c76a9077a5bb7cc1512b894d360169ec) on port 17557 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping MSEdgeDriver safe. MSEdgeDriver was started successfully. 2021-07-08 16:24:50 DEBUG Selenium polling for socket on ["127.0.0.1", 17557] 2021-07-08 16:24:51 INFO Selenium -> POST session 2021-07-08 16:24:51 INFO Selenium >>> http://127.0.0.1:17557/session | {"desiredCapabilities":{"browserName":"MicrosoftEdge","version":"","platform":"WINDOWS","javascriptEnabled":true,"cssSelectorsEnabled":true,"takesScreenshot":true,"nativeEvents":true,"rotatable":true,"ms:edgeOptions":{"args":["--disable-web-security"],"w3c":false}},"capabilities":{"firstMatch":[{"browserName":"MicrosoftEdge","ms:edgeOptions":{"args":["--disable-web-security"],"w3c":false}}]}}

2021-07-08 16:25:02 DEBUG Selenium > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/3.142.7 (ruby macosx)", "Content-Length"=>"2153"} 2021-07-08 16:25:02 INFO Selenium <- {"sessionId":"4f68a951ade6a304143ceb876d58f8dd","status":0,"value":[{"ELEMENT":"0.1779752229405389-1"}]} 2021-07-08 16:25:02 INFO Selenium -> POST session/4f68a951ade6a304143ceb876d58f8dd/execute 2021-07-08 16:25:02 INFO Selenium >>> http://127.0.0.1:17557/session/4f68a951ade6a304143ceb876d58f8dd/execute | {"script":"return arguments[0].matches(':disabled, select:disabled *')","args":[{"element-6066-11e4-a52e-4f735466cecf":"0.1779752229405389-1"}]} 2021-07-08 16:25:02 DEBUG Selenium > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/3.142.7 (ruby macosx)", "Content-Length"=>"144"} 2021-07-08 16:25:02 INFO Selenium <- {"sessionId":"4f68a951ade6a304143ceb876d58f8dd","status":17,"value":{"message":"javascript error: arguments[0].matches is not a function\n (Session info: MicrosoftEdge=91.0.864.64)\n (Driver info: msedgedriver=91.0.864.48 (27d934e7c76a9077a5bb7cc1512b894d360169ec),platform=Mac OS X 11.4.0 x86_64)"}}

Please help. Thank you.

Upvotes: 0

Views: 268

Answers (1)

The automator
The automator

Reputation: 87

I did lot of research and i feel the actual issue is with css selector.I changed #element :username, '.login-box form:first-of-type #username' to element :username,'#username[type=text]' ,then it started printing correct error. I was using "be_visible" Rspec, because of this I was getting error "MSEdgeDriver : Selenium::WebDriver::Error::JavascriptError: javascript error: arguments[0].matches is not a function".I replaced it with "be_present" and it is working for Edge and Chrome browser.

Upvotes: 1

Related Questions