Tag Info

Hot answers tagged

3

The answer provided by Sam nearly worked for me, but still had some problems as described above. Basically I needed to use TestRule instead of MethodRule, and TestWatcher() instead of TestWatchman() - since the former ones have been depreciated. I also needed to pass in "Description" instead of "FrameworkMethod" to get the name. Finally I need to ...


3

You can use the TestWatchman class which is part of JUnit to get the test case name, as well as the status, so you could take screenshots only on failure. Here's an example that takes a screenshot on failure: @Rule MethodRule watchman = new TestWatchman(){ @Override public void failed(Throwable e, FrameworkMethod method){ File scrFile = ...


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

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)); ...


2

You can open 2 browsers by initializing 2 firefox instance and then get() method will open URL in each browser accordingly. Do you want to use 1 firefox instance i.e. open it, close it and open it again ?


1

Try this, i hop this code work public static void main(String[] args) throws IOException { // Launch The Browser WebDriver driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); // Enter Url driver.get(baseurl); driver.close(); driver.quit(); WebDriver driver2 = new ...



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