nosuchelementexception

https login request - selenium webdriver

自古美人都是妖i 提交于 2021-02-11 17:55:35
问题 I was trying to access a https login url to login to a page and do my actions, but unable to do the same. These are my observations. When I hit the actual url, internally its leading to another url having JSESSION ID appended to it and then loading the requested page [now actual url formed]. Steps : The actual url is like : https:/abcd.xyz.com:7443/abcd/Web/Admin when I hit the above url driver.get("https:/abcd.xyz.com:7443/abcd/Web/Admin"); and when the test is running it appended Jsession

Should a Scanner only be instantiated only once? if that's the case why so?

时光毁灭记忆、已成空白 提交于 2021-02-07 08:29:29
问题 I know I'm going out on a limb here, but I just can't seem to understand why can't we just create an instance of the Scanner class twice. I'll add an example just in case. import java.util.Scanner; public class Nope { public static void main(String[] args) { System.out.println("What's your name?"); Scanner scanner = new Scanner(System.in); String name = scanner.nextLine(); System.out.println("Welcome " + name + "!"); scanner.close(); // Now System.out.println("where you do live?"); Scanner sc

Should a Scanner only be instantiated only once? if that's the case why so?

孤者浪人 提交于 2021-02-07 08:29:20
问题 I know I'm going out on a limb here, but I just can't seem to understand why can't we just create an instance of the Scanner class twice. I'll add an example just in case. import java.util.Scanner; public class Nope { public static void main(String[] args) { System.out.println("What's your name?"); Scanner scanner = new Scanner(System.in); String name = scanner.nextLine(); System.out.println("Welcome " + name + "!"); scanner.close(); // Now System.out.println("where you do live?"); Scanner sc

NoSuchElementException (SyntaxError: too many statically nested blocks)

痴心易碎 提交于 2021-01-29 12:43:17
问题 I am new in this and I am trying to figure out if there is a better way. Scraping some data from similar pages, but elements are changing and my solution is: try: p3 = driver.find_element_by_xpath("(//div/table)[2]/tbody/tr[contains(.,'4 - 10:00')]").text except NoSuchElementException: try: p3 = driver.find_element_by_xpath("(//div/table)[2]/tbody/tr[contains(.,'3 - 00:00')]").text except NoSuchElementException: try: p3 = driver.find_element_by_xpath("(//div/table)[2]/tbody/tr[contains(.,'4 -

org.openqa.selenium.NoSuchElementException

泪湿孤枕 提交于 2021-01-28 06:31:34
问题 I am trying to import login credential like: username and password using xsl sheet, by using below code but I got NoSuchElementException exception while running, my xsl sheet looks like: username | password -------------------------- jan30selenium | selenium am using: eclipse webdriver.iostream selenium tool Login.java: package Iostream; import java.io.FileInputStream; import jxl.Sheet; import jxl.Workbook; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa

Exception in thread “main” java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862)

那年仲夏 提交于 2020-05-30 19:15:14
问题 I really don't see what the problem could be. This is the error I'm getting: $javac Palindrome.java $java -Xmx128M -Xms16M Palindrome Enter your word Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextInt(Scanner.java:2117) at java.util.Scanner.nextInt(Scanner.java:2076) at Palindrome.main(Palindrome.java:28) This is the code: import java.io.*; import java.util

Protractor TRY/Catch issues

若如初见. 提交于 2020-01-16 03:56:18
问题 I was using Protractor and Cucumber and noticed that there were instances where I wanted to capture a NoSuchElementError: No element found using locator: By.cssSelector("someCssLocatorHere") . However, using the traditional try/catch block wouldn't work unless I called both the callback and errBack of the .then() function and throw the error so that I can catch it later like following: try{ somePromise.then(function(){ //callback function if promise gets resolved successfully }, function(e){

Probable impact of implicit wait removal

浪尽此生 提交于 2020-01-11 10:25:10
问题 In our Selenium automated tests, we've implicit and explicit waits. As per Jim Evan's thought https://stackoverflow.com/a/15174978/1471417, they should not be mixed. Hence planning to remove implicit wait. For our tests, whenever we interact with an element, we've used explicit wait for it to be visible, clickable etc. with ignoring NoSuchElementException . That's why I don't think, it will throw NoSuchElementException immediately. This makes sure removing implicit wait won't affect my tests.

Issue with java Scanner not taking nextLine on new instance

本秂侑毒 提交于 2020-01-05 02:37:08
问题 package sandbox2; import java.util.Scanner; public class Sandbox2 { public static void main(String[] args) { for (int i = 0; i < 5; i++) { String s = askForProperty("Enter value for " + i + ": "); System.out.println(i + " is: " + s); } } private static String askForProperty(String message) { Scanner keyboard = new Scanner(System.in); System.out.print(message); String s = keyboard.nextLine(); keyboard.close(); return s; } } When i run the above code, it returns the first response PERFECTLY.

Handle the NoSuchElementException in Fluent Wait

六月ゝ 毕业季﹏ 提交于 2020-01-01 16:13:33
问题 I know that in terms of waiting for web element that isn't in the DOM yet, the most efficient is a fluent wait. So my question is: Is there a way to handle and catch the NoSuchElementException or any exception that fluent wait might throw because the element is not existing? I need to have a boolean method wherein it will give me result whether the element is found or not. This method is quite popular on the web. public void waitForElement(WebDriver driver, final By locator){ Wait<WebDriver>