Tag Info

Hot answers tagged

4

Try this line of code: Driver.findElement(By.xpath("enter your xpath")).click(); Hope it works out!


3

You should be splitting the xpath to fetch individual tables for clarity sake. I suggest the following: // Get the content or container WebElement content = driver.findElement(By.id("contentText")); //Get the table of users WebElement tblUsers = content.findElement(By.xpath(".//table/tbody/tr[2]/td/table/tbody/tr/td[1]/table")); // Get the rows which ...


3

When I first need a helper method, I put it in the same class as the test code that calls it. In your example, you could implement the helper method as a private method inside the Serp34Check class: private static void checkForFeed(xpath, feedName) { try { WebElement feedElement = driver.findElement(By.xpath(xpath)); ...


3

Try changing the loop condition to i<3 and use Thread.sleep(); method of java to wait for the visibility of the element instead of the web driver's wait command. Let me know if this works out. In the meanwhile, will try to search a more robust solution for this.


3

driver = webdriver.Firefox() driver.implicitly_wait(10) # seconds driver.get("http:// enter your URL.") myDynamicElement = driver.find_element_by_id("myDynamicElement") Try above code and see if it is working or not.


3

wait = WebDriverWait(driver, 10) element = wait.until(EC.element_to_be_clickable((By.ID,'someid'))) Try above code and see if it is working or not.


3

In selenium the wait command doesn't really wait sometimes. That is there is some problem with that command. You can try the time.sleep(); command of python. It is an equivalent of the Thread.sleep(); command of Java. It will pause the execution of code for defined time limit. So you can give sufficient time that will allow your page to load. Hope it ...


3

Try this Driver.SwitchTo().frame("Fancybox-frame"); Driver.findElement("enter your xpath to close popup").click(); Driver.SwitchTo().defaultContent();


1

Try writing a method that you can reuse whenever you want to find a new web element, but that will timeout after a specific time. You want to try/catch all the WebDriver exceptions, not just Stale Element. Make sure to include a sleep time in the catch, or else the test will retry like crazy whenever a try fails. Here is an example: public static ...



Only top voted, non community-wiki answers of a minimum length are eligible