Hot answers tagged selenium
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/td/table/tbody/tr/td/table")); // Get the rows which ...
you can pass the driver as argument to the methods , so no need to re create them.
Seems that you want to have a tool which can translate requirements/test cases (written by business people with no experience in programming) into executable code. In our practice FitNesse is not that tool. We started with FitNesse, and keep maintaining existing tests and even adding new when feasible, but these tests are written by developers, not business ...
You can use WebDriverWait to synch with page load. Something like the following might help WebDriverWait wait = new WebDriverWait(driver, 15); //you can play with the time integer to wait for longer than 15 seconds.` wait.until(ExpectedConditions.titleContains("title")); //if you want to wait for a particular title to show up OR ...
You need to tell it to return the value. Change this line: String mainURL = (String) js.executeScript("productObj.mainURL"); to: String mainURL = (String) js.executeScript("return productObj.mainURL");
Use xpath. I don't know what language you're using, but in Python it would be: driver.find_elements_by_xpath('//div[@class="item"]')
You can use the "not" pseudo-class in a CSS selector like this: div.item:not(.sold-out)
Only top voted, non community-wiki answers of a minimum length are eligible