9

I was trying to run selenium with phantomjs headless browser and getting "phantomjs://platform/console++.js:263 in error" error message.

Searched over internet but did not get any solution, so asking here.

Same code and solution not working for me Link

Why I am getting this error message?, is this phantomjs issue or selenium?. Let me know how to resolve it?.

Configuration:

1) Selenium 2.53.1.jar

2) Phantomjs 2.1.1 .exe

3) Junit4

Code:

private PhantomJSDriver driver; private String baseUrl; @Before public void setUp() throws Exception { // File file = new File("D:/Selenium/Drivers/phantomjs.exe"); // System.setProperty("phantomjs.binary.path", file.getAbsolutePath()); System.setProperty("phantomjs.binary.path", "D:/Selenium/Drivers/phantomjs.exe"); Capabilities caps = new DesiredCapabilities(); ((DesiredCapabilities) caps).setJavascriptEnabled(true); ((DesiredCapabilities) caps).setCapability("takesScreenshot", true); //((DesiredCapabilities) caps).setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "D:/Selenium/Drivers/phantomjs.exe"); WebDriver driver = new PhantomJSDriver(caps); driver = new PhantomJSDriver(); baseUrl = "http://www.gts.fiorentina.test/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.get(baseUrl + "/Account/Login.aspx?ReturnUrl=%2f"); driver.findElement(By.id("tbUserName_I")).clear(); driver.findElement(By.id("tbUserName_I")).sendKeys("rogai"); driver.findElement(By.id("tbPassword_I")).clear(); driver.findElement(By.id("tbPassword_I")).sendKeys("Fiorentina2014!"); driver.findElement(By.id("btnLogin_CD")).click(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void testCreazione() throws Exception { driver.get(baseUrl + "/SegreteriaSportiva/Calciatori.aspx"); driver.findElement(By.cssSelector("#ASPxButton1_CD > span")).click(); driver.findElement(By.id("FrmEdit_TS_TipoPersonaId_FK_B-1")).click(); driver.findElement(By.id("FrmEdit_TS_TipoPersonaId_FK_DDD_L_LBI2T0")).click(); driver.findElement(By.id("FrmEdit_Nome_I")).clear(); driver.findElement(By.id("FrmEdit_Nome_I")).sendKeys("Prova"); driver.findElement(By.id("FrmEdit_Cognome_I")).clear(); driver.findElement(By.id("FrmEdit_Cognome_I")).sendKeys("Calciatore"); driver.findElement(By.id("FrmEdit_TS_RuoloId_FK_B-1")).click(); driver.findElement(By.id("FrmEdit_TS_RuoloId_FK_DDD_L_LBI3T0")).click(); driver.findElement(By.id("FrmEdit_DataNascita_I")).clear(); driver.findElement(By.id("FrmEdit_DataNascita_I")).sendKeys("01/01/2014"); driver.findElement(By.id("FrmEdit_Cittadinanza_I")).clear(); driver.findElement(By.id("FrmEdit_Cittadinanza_I")).sendKeys("italiana"); driver.findElement(By.id("FrmEdit_LuogoNascita_I")).clear(); driver.findElement(By.id("FrmEdit_LuogoNascita_I")).sendKeys("roma"); driver.findElement(By.cssSelector("#BTN_Edit_CD > span")).click(); driver.findElement(By.id("Grid_DXFREditorcol3_I")).click(); driver.findElement(By.id("Grid_DXFREditorcol3_I")).sendKeys("Prova"); } 

Error message:

 INFO: environment: {} [INFO - 2016-11-15T00:41:42.115Z] GhostDriver - Main - running on port 20668 [INFO - 2016-11-15T00:41:42.955Z] Session [4766f980-aacc-11e6-a7fd-efd8c5848edd] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1","webSecurityEnabled":true} [INFO - 2016-11-15T00:41:42.955Z] Session [4766f980-aacc-11e6-a7fd-efd8c5848edd] - page.customHeaders: - {} [INFO - 2016-11-15T00:41:42.956Z] Session [4766f980-aacc-11e6-a7fd-efd8c5848edd] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"2.1.1","driverName":"ghostdriver","driverVersion":"1.2.0","platform":"windows-7-32bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}} [INFO - 2016-11-15T00:41:42.956Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 4766f980-aacc-11e6-a7fd-efd8c5848edd [ERROR - 2016-11-15T00:42:27.341Z] WebElementLocator - _handleLocateCommand - Element(s) NOT Found: GAVE UP. Search Stop Time: 1479170547300 phantomjs://platform/console++.js:263 in error 
6
  • 3
    Did you ever figure this out? Having the same problem Commented Jun 21, 2017 at 19:00
  • @Matt1776: No. I saw somewhere and someone commented that there is no support for phantomjs headless browser. Please let me know if any one got the solution. Commented Jul 29, 2017 at 4:00
  • We actually made the switch to phantomJS web driver because of the headless support. I was able to get the code to perform, however I was unable to get rid of the error message. If you are still having trouble getting this to run, could you indicate which line is giving you trouble? Commented Aug 2, 2017 at 9:09
  • Yes this error is displayed in my case too but there is no test case failure. Weird. Commented Feb 26, 2018 at 8:40
  • Leave phantomjs and use chrome or firefox. they now provide headless support directly. Commented Jun 15, 2018 at 7:00

1 Answer 1

1

Just set the driver capabilities to set the web driver log level to NONE . The logs won't appear.

 String[] phantomArgs = new String[] { "--webdriver-loglevel=NONE" }; desireCaps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, phantomArgs); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.