I am working with a page that has some JS errors like TypeError: 'undefined' is not a function (evaluating 'q.apply(m,d)'), browsers seem to ignore these errors and the page functionality doesn't degrade, but PhantomJS throws an exception. How can I disable that? I've read how to ignore errors in phantomjs but I don't know how to do that with Selenium.
When I run my tests using PhantomJS 2.0 then I do not get the non-fatal javascript errors getting reported. However when I run with PhantomJS version 1.9.8 then I get the exact behavior that you describe. So simply upgrading the version of PhantomJS you are using to the latest may solve your problem.
Otherwise you can change the logging level of PhantomJS. I believe you can use code like this below where you instantiate the browser.
DesiredCapabilities caps = new DesiredCapabilities();
caps.setJavascriptEnabled(true);
caps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, "--webdriver-loglevel=ERROR");
WebDriver driver = new PhantomJSDriver(caps);
Related
As stated, I am trying to use webdriver.Chrome in this sample project I'm doing but I am completely lost on what to do. This is the error I get error. But when I look at the version of chrome I installed, it seemed to match up. Chrome Version. Does anyone know what's happening? Sorry if the post is too unspecific.
You have to update your chrome browser. Try to update the installed chrome version to latest version.
To overcome this problem, use WebDriverManager: refer - https://bonigarcia.dev/webdrivermanager/ and https://github.com/bonigarcia/webdrivermanager.
If you are using Python with selenium, refer to this post for sample code:
Chrome with WebDriver--Why is it disappearing as soon as I hit "run"? Chrome Driver version 106 but Chrome can only be 105.0.9
If you are using Java with selenium, refer to this post for sample code:
element click intercepted in Selenium wedriver
My mac auto-updated safari to v12.1, but now I can't run my nightwatch tests against safari. I just always get the error: "Request body does not contain required parameter 'capabilities'.". I think it's related to this issue: https://github.com/SeleniumHQ/selenium/issues/6431
Is there anything I can update or do inside of nightwatch to get the tests to run again?
Turns out safari made some huge breaking changes in v12. They removed support for the Selenium JSON wire protocol and now only support w3c WebDriver protocol. There isn't much you can do from a nightwatch config standpoint to fix this. Just try to find the w3c equivalent command for what you are trying to do and use that instead.
Ref: https://developer.apple.com/documentation/webkit/macos_webdriver_commands_for_safari_12_and_later
All of my tests run without issue in Chrome or Firefox, but when Protractor is used, I'm getting the following error message:
/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/async/nexttick.js:41
goog.global.setTimeout(function() { throw exception; }, 0);
^
Error while waiting for Protractor to sync with the page: "window.angular is undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details"
Going to http://git.io/v4gX results in a 404 error.
I'm encountering this same error message whether using
$ webdriver-manager start or
$ phantomjs --webdriver=9515
Using Protractor v3.0.0 and PhantomJS 2.1.1
I've seen similar queries for this issue:
Error while waiting for Protractor to sync with the page: "window.angular is undefined
The stated answer is we're trying to make phantomJS go to a page that isn't Angular, but that is definitely not our situation, as the page is Angular.
"window.angular is undefined." when using protractor for automated testing?
Here the supplied answer is use Protractor 3.0 and specify Jasmine2. Those are our currently supplied settings.
Protractor running tests on PhantomJS
States this issue was fixed in a prior Protractor release, but it appears to be back again.
I'm re-asking this question because the previous answers are now obsolete and irrelevant.
I am successfully using the Conductor framework to scrape data off a website. I use the Chrome browser and therefore I have installed chromedriver.exe in the root of my project.
To speed things up I want to replace Chrome with the headless PhantomJS browser. I installed PhantomJS as explained in the answer to this Stackoverflow question: PhantomJS & Conductor Framework and have changed the browser to Browser.PHANTOMJS in #Config.
Whatever I do however, I get no results.
I found no documentation how to setup PhantomJS for use with Selenium or PhantomJS.
The question How to Implement Selenium WebDriver with PhantomJS and Can we Use Sikuli with PhantomJS? did not help either.
How to replace Chrome with PhantomJS for use with Selenium and Conductor?
The trouble you are having appears to be due to an older version of the PhantomJS library included in Conductor. The error when running PhantomJS can be found in this imported issue on the Selenium Github. The remedy is to import a fork of PhantomJS which works with the newer releases of Selenium.
You can easily implement this by editing the pom.xml file and swapping
<groupId>com.github.detro</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>${phantomjs_version}</version>
with
<groupId>com.codeborne</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.2.1</version>
You can use a headless chrome driver with selenium, as showed here:
https://duo.com/decipher/driving-headless-chrome-with-python
I have a local selenium server (2.42.2) running with Chromedriver and Firefox. It seems to get stuck after loading and running client.html. I can see that my functional suite code runs in node, far enough to execute the main body. Anything in registerSuite never gets called.
Here are the selenium logs:
http://pastebin.com/KKg5ycvW
I can see the browsers in the selenium sessions page, but they don't appear to be doing anything.
Try opening up a new browser window and paste in the url that you see in the existing selenium ones. Then open up dev tools and see what console errors you are getting.
Intern's runner seems to get stuck in an infinite loop if any uncaught javascript errors are thrown during unit tests if the 'reporter' hasn't been setup yet.
This has been raised as an issue in intern's github repository.