hyperia-sk/highlight-ception

Does not work with different types of xpaths

Closed this issue · 7 comments

Codeception v2.3.3
testing with canSeeElement

throws unknown error
vendor\hyperia\highlight-ception\src\HighlightCeption.php:70
vendor\hyperia\highlight-ception\src\HighlightCeption.php:144

Sample Xpaths

//td[contains(text(),'text)]/..//..//a[text()='Edit text']
//a[text()='text2']//..//..//td[text()='text3']//..//td[text()='Inactive']

Can we incorporate xpath.js to resolve different resolve different types of xpaths instead of using the function resolveCssSelector

Link to xpath.js
https://github.com/ilinsky/xpath.js/tree/5148efe5851babf06376214cf4f572803f904d41

@kpascal thanks for your report

fixed in ad35f31, you can see xpath usage here

kdp88 commented

Ran my test with the newest code and got the error below

[Facebook\WebDriver\Exception\UnknownServerException] unknown error: call function result missing int 'status'
(Session info: chrome=60.0.3112.101)

vendor\hyperia\highlight-ception\src\HighlightCeption.php:173
vendor\hyperia\highlight-ception\src\HighlightCeption.php:96

@kdp88 thanks for your report, please:

  • Provide test source code.
  • Provide console output if related. Use -vvv mode for more details.
  • What code exactly do you use to create the instance of WebDriver?
  • How do you start Selenium server?
  • What version of Selenium server do you use, please?
kdp88 commented

Provide test source code

codeception v2.3.3

Provide console output if related. Use -vvv mode for more details.

 I wait for element visible "//a[@id="CCViewtabICLink"]",10
 I am going to Verify User can access the IC Users tab and verify data is populated correctly
 I click {"xpath":"\/\/a[@id=\"CCViewtabICLink\"]"}
 I wait for text "Online Status",10
 I can see element "//td[contains(text(),'Online Status')]/..//..//span[contains(text(),'Active')]//a[text()='Unsubscribe Account']"
 ERROR



Time: 14.18 seconds, Memory: 13.25MB

There was 1 error:

---------
1) ICUsersTabCest: Verify ic users tab function
 Test  tests\cc\90\AccountCentric\AccountView\InvoiceCentralTab\ICUsersTabCest.php:VerifyICUsersTabFunction

[Facebook\WebDriver\Exception\UnknownServerException] unknown error: call function result missing int 'status'
  (Session info: chrome=60.0.3112.101)
  (Driver info: chromedriver=2.29.461591 (62ebf098771s7915b233),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 18 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'sdfsdfsdf', ip: '1sdsss3', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_40'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.29.461591 (62ebf098771772160f391d75e589dc5679
15b233), userDataDir=ssdsdf92_31683}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, ver
sion=60.0.3112.101, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true,
javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]

Scenario Steps:

 64. $I->canSeeElement("//td[contains(text(),'Online Status')]/..//..//span[contains(text(),'Active')]//a[text()='Unsubscribe Account']") at tests\cc\90\AccountCentric\AccountView\InvoiceCentralTab\IC
UsersTabCest.php:43
 63. $I->waitForText("Online Status",10) at tests\cc\90\AccountCentric\AccountView\InvoiceCentralTab\ICUsersTabCest.php:42
 62. $I->click({"xpath":"\/\/a[@id=\"CCViewtabICLink\"]"}) at tests\cc\90\AccountCentric\AccountView\InvoiceCentralTab\ICUsersTabCest.php:41
 61. // I am going to Verify User can access the IC Users tab and verify data is populated correctly
 60. $I->waitForElementVisible("//a[@id="CCViewtabICLink"]",10) at tests\cc\90\AccountCentric\AccountView\InvoiceCentralTab\ICUsersTabCest.php:39
 59. $I->click({"link":"733344"}) at tests\_support\searchHelper.php:75

#1  C:\yyyy\vendor\facebook\webdriver\lib\remote\HttpCommandExecutor.php:320
#2  C:\yyyyy\vendor\facebook\webdriver\lib\remote\RemoteWebDriver.php:535
#3  C:\yyyyy\vendor\facebook\webdriver\lib\remote\RemoteWebDriver.php:296
#4  C:\yyyyy\vendor\hyperia\highlight-ception\src\HighlightCeption.php:173
#5  C:\yyyyy\vendor\hyperia\highlight-ception\src\HighlightCeption.php:96
#6  Codeception\Module\HighlightCeption->seeElement
#7  C:\yyyyy\tests\_support\_generated\CCTesterActions.php:2238
#8  C:\yyyyy\tests\testcest.php:43
#9  ICUsersTabCest->VerifyICUsersTabFunction

ERRORS!

How do you start Selenium server?

i am using a batch file to call the selenium .jar file

What version of Selenium server do you use, please?

selenium-server-standalone-3.5.0.jar

Please run your codecept with disabled HighlighCodecept module and check your test output.

kdp88 commented

@arzzen sorry for the confusion, this is @kpascal on my personal account, I have been running the same tests in all my testing of this package. this successfully passes without the highlight text module

kdp88 commented

@arzzen just updated to 1.1.1 and all seems to be well with different types of xpaths

Thanks!