Trying to Automate clap of medium.com

Trying to Automate clap of medium.com

Some how clap option is not getting clicked on medium.com ,here is code and error

WebUI.openBrowser('https://accounts.google.com')

WebUI.maximizeWindow()

def driver = DriverFactory.getWebDriver()

String baseUrl = 'https://accounts.google.com'

selenium = new WebDriverBackedSelenium(driver, baseUrl)

selenium.open('https://accounts.google.com/signin/v2/identifier?passive=1209600&continue=https%3A%2F%2Faccounts.google.com%2FManageAccount&followup=https%3A%2F%2Faccounts.google.com%2FManageAccount&flowName=GlifWebSignIn&flowEntry=ServiceLogin')

selenium.type('id=identifierId', 'emailid')

WebUI.delay(5)

WebUI.click(findTestObject('Page_Gmail/Page_Gmail/content_Next'))

WebUI.delay(5)

selenium.type('name=password', 'passwd')

WebUI.click(findTestObject('Page_Gmail/Page_Gmail/span_Next'))

WebUI.delay(5)

selenium.open('https://medium.com/')

selenium.click('link=Sign in')

selenium.open('https://medium.com/s/user-friendly/why-im-done-saying-user-user-experience-and-ux-in-2019-4fdfc6b7de23')

WebUI.delay(4)

WebUI.click(findTestObject('Object Repository/Page_Medium  a place to read and wr/button_Continue as george'))

WebUI.waitForElementClickable(findTestObject('Page_A New Test Predicts When Youll/clap'), 5)

WebUI.click(findTestObject('Page_A New Test Predicts When Youll/clap'), FailureHandling.STOP_ON_FAILURE)

Error in console i get:-
SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]
SLF4J: See SLF4J Error Codes for further details.
2019-02-01 20:27:20.127 e[34mINFO e[0;39m e[36mc.k.katalon.core.main.TestCaseExecutor -e[0;39m e[39m--------------------e[0;39m
2019-02-01 20:27:20.127 e[34mINFO e[0;39m e[36mc.k.katalon.core.main.TestCaseExecutor -e[0;39m e[39mSTART Test Cases/mediume[0;39m
2019-02-01 20:27:24.502 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m1: openBrowser(“https://accounts.google.com”)e[0;39m
2019-02-01 20:27:25.744 e[34mINFO e[0;39m e[36mc.k.k.core.webui.driver.DriverFactory -e[0;39m e[39mStarting ‘Chrome’ drivere[0;39m
2019-02-01 20:27:25.816 e[34mINFO e[0;39m e[36mc.k.k.core.webui.driver.DriverFactory -e[0;39m e[39mAction delay is set to 0 secondse[0;39m
Starting ChromeDriver 2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a) on port 35382
Only local connections are allowed.
Feb 01, 2019 8:27:37 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
2019-02-01 20:27:37.716 e[34mINFO e[0;39m e[36mc.k.k.core.webui.driver.DriverFactory -e[0;39m e[39msessionId = 66373c7f8f554fa9603f1a22a0fbabd4e[0;39m
2019-02-01 20:27:37.802 e[34mINFO e[0;39m e[36mc.k.k.core.webui.driver.DriverFactory -e[0;39m e[39mbrowser = Chrome 71.0.3578.98e[0;39m
2019-02-01 20:27:37.803 e[34mINFO e[0;39m e[36mc.k.k.core.webui.driver.DriverFactory -e[0;39m e[39mplatform = Windows Server 2016e[0;39m
2019-02-01 20:27:37.812 e[34mINFO e[0;39m e[36mc.k.k.core.webui.driver.DriverFactory -e[0;39m e[39mseleniumVersion = 3.7.1e[0;39m
2019-02-01 20:27:37.815 e[34mINFO e[0;39m e[36mc.k.k.core.webui.driver.DriverFactory -e[0;39m e[39mproxyInformation = ProxyInformation{proxyOption=NO_PROXY, proxyServerType=HTTP, password=, proxyServerAddress=, proxyServerPort=0}e[0;39m
2019-02-01 20:27:41.934 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m2: maximizeWindow()e[0;39m
2019-02-01 20:27:43.322 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m3: driver = getWebDriver()e[0;39m
2019-02-01 20:27:43.350 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m4: baseUrl = "https://accounts.google.com"e[0;39m
2019-02-01 20:27:43.350 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m5: selenium = new com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium(driver, baseUrl)e[0;39m
2019-02-01 20:27:43.502 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m6: selenium.open(“Sign in - Google Accounts”)e[0;39m
2019-02-01 20:27:45.541 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m7: selenium.type(“id=identifierId”, “georgejohn7866”)e[0;39m
2019-02-01 20:27:45.918 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m8: delay(5)e[0;39m
2019-02-01 20:27:50.967 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m9: click(findTestObject(“Page_Gmail/Page_Gmail/content_Next”))e[0;39m
2019-02-01 20:27:51.614 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m10: delay(5)e[0;39m
2019-02-01 20:27:56.618 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m11: selenium.type(“name=password”, “George@321”)e[0;39m
2019-02-01 20:27:56.816 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m12: click(findTestObject(“Page_Gmail/Page_Gmail/span_Next”))e[0;39m
2019-02-01 20:27:57.135 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m13: delay(5)e[0;39m
2019-02-01 20:28:02.144 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m14: selenium.open(“https://medium.com/”)e[0;39m
2019-02-01 20:28:05.599 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m15: selenium.click(“link=Sign in”)e[0;39m
2019-02-01 20:28:06.595 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m16: selenium.open(“As a Designer, I Refuse to Call People ‘Users’ | by Adam Lefton | Medium”)e[0;39m
2019-02-01 20:28:08.393 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m17: delay(4)e[0;39m
2019-02-01 20:28:12.868 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m18: click(findTestObject(“Object Repository/Page_Medium a place to read and wr/button_Continue as george”))e[0;39m
2019-02-01 20:28:13.473 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m19: waitForElementClickable(findTestObject(“Page_A New Test Predicts When Youll/clap”), 5)e[0;39m
2019-02-01 20:28:19.777 e[34mINFO e[0;39m e[36mc.k.k.c.webui.common.WebUiCommonHelper -e[0;39m e[39mUnable to find the element located by 'By.xpath: '. Please recheck the objects properties to make sure the desired element is located. e[0;39m
2019-02-01 20:28:19.779 e[31mWARN e[0;39m e[36mk.c.w.k.b.WaitForElementClickableKeyword -e[0;39m e[39mWeb element with id: ‘Object Repository/Page_A New Test Predicts When Youll/clap’ located by 'By.xpath: ’ not founde[0;39m
2019-02-01 20:28:19.780 e[39mDEBUGe[0;39m e[36mtestcase.medium -e[0;39m e[39m20: click(findTestObject(“Page_A New Test Predicts When Youll/clap”), STOP_ON_FAILURE)e[0;39m
2019-02-01 20:28:50.851 e[34mINFO e[0;39m e[36mc.k.k.c.webui.common.WebUiCommonHelper -e[0;39m e[39mUnable to find the element located by 'By.xpath: '. Please recheck the objects properties to make sure the desired element is located. e[0;39m
2019-02-01 20:28:51.673 e[1;31mERRORe[0;39m e[36mc.k.k.core.keyword.internal.KeywordMain -e[0;39m e[31m❌ Unable to click on object ‘Object Repository/Page_A New Test Predicts When Youll/clap’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Page_A New Test Predicts When Youll/clap’ located by 'By.xpath: ’ not found)e[0;39m
2019-02-01 20:28:51.721 e[1;31mERRORe[0;39m e[36mc.k.katalon.core.main.TestCaseExecutor -e[0;39m e[31m❌ click(findTestObject(“Page_A New Test Predicts When Youll/clap”), STOP_ON_FAILURE) FAILED.e[0;39m
e[31mReason:e[0;39m
e[31mcom.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Page_A New Test Predicts When Youll/clap’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Page_A New Test Predicts When Youll/clap’ located by 'By.xpath: ’ not found)e[0;39m
e[31m at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:36)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:27)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:86)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)e[0;39m
e[31m at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:53)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:604)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)e[0;39m
e[31m at medium.run(medium:69)e[0;39m
e[31m at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)e[0;39m
e[31m at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:328)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:319)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:298)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:290)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:224)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:106)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:97)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)e[0;39m
e[31m at TempTestCase1549052829794.run(TempTestCase1549052829794.groovy:22)e[0;39m
2019-02-01 20:28:51.740 e[1;31mERRORe[0;39m e[36mc.k.katalon.core.main.TestCaseExecutor -e[0;39m e[31m❌ Test Cases/medium FAILED.e[0;39m
e[31mReason:e[0;39m
e[31mcom.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Page_A New Test Predicts When Youll/clap’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Page_A New Test Predicts When Youll/clap’ located by 'By.xpath: ’ not found)e[0;39m
e[31m at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:36)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:27)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:86)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)e[0;39m
e[31m at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:53)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:604)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)e[0;39m
e[31m at medium.run(medium:69)e[0;39m
e[31m at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)e[0;39m
e[31m at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:328)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:319)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:298)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:290)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:224)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:106)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:97)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)e[0;39m
e[31m at TempTestCase1549052829794.run(TempTestCase1549052829794.groovy:22)e[0;39m
2019-02-01 20:28:51.740 e[34mINFO e[0;39m e[36mc.k.katalon.core.main.TestCaseExecutor -e[0;39m e[39mEND Test Cases/medium

Xpath for clap
(.//*[normalize-space(text()) and normalize-space(.)=‘Marina Posniak’])[1]/following::button[1]
Interstingly when i try to find element using above xpath,i am able to find the clap element but dont know why katalon unable to find and then click it,if nothing works i may have to switch from katalon to python programming

Hang on, hang on… we’re not quite at that point just yet.

Looking at that output, it seems to me pretty much all of Katalon is working fine, except maybe your xpath.

Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException:
Web element with id: Object Repository/Page_A New Test Predicts When Youll/clap
located by 'By.xpath: ’ not found

It looks to me as though your xpath is not found – actually, it seems to be missing. I could be wrong, I’m not an xpath expert by any means, but an empty xpath is probably what I’d be considering first.

See if you can figure out why it’s gone astray and report back.

I have a sneaking suspicion that it has to do with some of the lines before the one that fails. In particular, here:

selenium.open('https://medium.com/')

selenium.click('link=Sign in')

selenium.open('https://medium.com/s/user-friendly/why-im-done-saying-user-user-experience-and-ux-in-2019-4fdfc6b7de23')

Can you pause the script execution after that last line (the open('https://medium.com/s/user-friendly/why-im-done-saying-user-user-experience-and-ux-in-2019-4fdfc6b7de23')), then try running your xpath? Since you are not navigating to the page in question using a search/clicks/etc., but instead just injecting a url, I’m thinking that the page is not in the state you are expecting when you do it manually. Are you sure that you are truly “signed in” at this point?

It worked ,just needed a small tick called Detect Object By in katalon studio,thanks everyone

1 Like

Thanks for reporting back.

1 Like