maxwu / cucumber-java-toy

♖ Demo to show Selenium PageObjects with JUnit in Cucumber-JVM on unit conversion and GeoIP location
1 stars 3 forks source link

WebDriver.getTitle() returns partial url instead #9

Closed maxwu closed 7 years ago

maxwu commented 7 years ago

With Chrome Browser Version 56.0.2924.87 (64-bit) and ChromeDriver 2.27.440174 on Mac 10.11.6, the getTitle() call returns url contents instead of title string.

... com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 org.maxwu.jrefresh.selenium.BlogCommentTest
Case a01checkComments starts.
Arch=64
Starting ChromeDriver 2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9) on port 1773
Only local connections are allowed.
Feb 24, 2017 11:01:12 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
**** Created Web Driver #243194708****
**** Destroying Web Driver #243194708****
Case a01checkComments fails.

org.maxwu.jrefresh.selenium.pageObjects.WrongPageException: Wrong Title with Pattern ".*Max.*", title=maxwu.me, url=http://maxwu.me/2016/10/02/dropme/

    at org.maxwu.jrefresh.selenium.pageObjects.PageBase.checkTitle(PageBase.java:45)
    at org.maxwu.jrefresh.selenium.pageObjects.PageBase.checkTitle(PageBase.java:55)
    at org.maxwu.jrefresh.selenium.pageObjects.BlogCommentPage.<init>(BlogCommentPage.java:39)
    at org.maxwu.jrefresh.selenium.BlogCommentTest.setUp(BlogCommentTest.java:40)
maxwu commented 7 years ago

Fixed. It is an environment issue. The ShadowSock client is launched incidentally but via an invalid proxy setting record. Therefore, the WebDriver reported partial URL (removed protocol header like http:// or https://) as title.