Forum Posts

bogelena5
May 31, 2018
In Selenium Questions
private int resultsCount() { WebElement label = findVisibleElement(TOTAL_COUNT_ID); String text = label.getText(); int count = Integer.parseInt(text); return count; } When hover mouse over parseInt you can see that: int java.lang.Integer.parseInt(String arg0) throws NumberFormatException It might happen if the string does not contain a parsable integer. But the string in this case is 37,183 , means parsable. What is wrong then?
NumberFormatException content media
0
2
14
bogelena5
May 22, 2018
In Selenium Questions
HomeworkTests_NoMethods.java contains three unit tests: broadenSearchShowsMoreResults() bookInfoIsCorrectOnDetailsPage() paginationWorksInDetailsPage() and all of them have the same step "search for keyword". //searchFor(searchKeyword); WebElement searchBox = wait.until(ExpectedConditions. visibilityOfElementLocated(searchBoxId)); searchBox.sendKeys(searchKeyword); WebElement searchButton = wait.until(ExpectedConditions. visibilityOfElementLocated(searchButtonId)); searchButton.click(); But for some reason only first broadenSearchShowsMoreResults() works, but other two failed on that step in spite of code is exactly the same: Error message in trace: org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (1583, 230)
0
6
24
bogelena5
May 21, 2018
In Selenium Questions
Hi Alex, I've created two different xpaths and both do not work. When I'm testing each xpath in console it works: $x("(//input[@type = 'text'])[1]") [input] $x("(//input[@placeholder ='Enter Keyword or Item No.'])[1]") [input] but test still fails. final By SEARCH_BOX_NAME = //By.name("q"); By.xpath("(//input[@placeholder ='Enter Keyword or Item No.'])[1]"); // By.xpath("(//input[@type = 'text'])[1]"); here is a trace: org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: By.xpath: (//input[@placeholder ='Enter Keyword or Item No.'])[1] (tried for 15 second(s) with 500 milliseconds interval) Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z' System info: host: 'ALENA-PC', ip: '192.168.0.11', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '10.0.1' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.38.552522 (437e6fbedfa876..., userDataDir: C:\Users\Elena\AppData\Loca...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 66.0.3359.181, webStorageEnabled: true} Session ID: e5d47f2ee263343a1f3de49b60b54252 at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:81) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:271) at StaleElementException.changeSortOrderWorks(StaleElementException.java:71) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) at org.testng.internal.Invoker.invokeMethod(Invoker.java:580) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:716) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:988) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.privateRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:505) at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) at org.testng.SuiteRunner.run(SuiteRunner.java:364) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) at org.testng.TestNG.runSuitesLocally(TestNG.java:1137) at org.testng.TestNG.runSuites(TestNG.java:1049) at org.testng.TestNG.run(TestNG.java:1017) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77) What is wrong with them? Thank you.
0
5
13

bogelena5

More actions