Selenium points
m936956
这个作者很懒,什么都没留下…
展开
-
Right click
Methods 1:RemoteWebElement e = (RemoteWebElement) d.findElement(By.id("2003167469"));Coordinates where = e.getCoordinates();d.getMouse().contextClick(where);d.findElementByLinkText("Find playe原创 2017-03-09 14:45:43 · 300 阅读 · 0 评论 -
Selenium Workflow
原创 2019-05-22 14:15:05 · 113 阅读 · 0 评论 -
Framework - Java+Selenium+TestNG
How to use it: 1. Create test case which extends BaseTestCase, or BaseWebTestCase. 2. Create testNG test suite xml files. Setting parameters url, browser and environment....原创 2019-05-22 14:13:00 · 146 阅读 · 0 评论 -
Switch Window
If the new window wiht name attribute:driver.switchTo().window(<windowName>);Otherwise: public static final boolean switchToWindowByTitle(final String windowTitle) { String ...原创 2019-05-21 17:48:19 · 670 阅读 · 0 评论 -
Take Screenshot, and take screenshot on failure
public final class SeleniumUtils { public static String SCREENSHOT_PATH = "./screen_shots/"; private static final Logger log = LoggerFactory.getLogger(SeleniumUtils.class); public static...原创 2019-05-21 16:32:03 · 430 阅读 · 0 评论 -
Drag and Drop
Drag and drop single elementActions action = new Actions (driver);action.dragAndDrop(sourceElement, targetElement).perform();Drag and Drop multiple elementsDrag source element, and move Elem...原创 2019-05-21 10:00:58 · 186 阅读 · 0 评论 -
Using JavaScript in Selenium
1. Scroll page: public static final void scrollToTop() { ((JavascriptExecutor) Config.driver()).executeScript("scrollTo(0, 0)"); } public static final void scrollToBottom() ...原创 2019-05-21 09:17:14 · 114 阅读 · 0 评论 -
DB related: backup, restore, quary, update
1. On common layer, define DBRestoreUtils, and DBUtils2. On page layer, use above public void backUpDemo() throws Exception{ Connection cn = DBUtils.getConnection("oracle_"); ...原创 2019-05-20 15:34:32 · 124 阅读 · 0 评论 -
Download CSV and compare content
On page layer, define download and compare method: public List<String> downloadReport(int index){ WebElement locator = driver.findElement(By.cssSelector("a[title='Download']")); ...原创 2019-05-20 15:20:27 · 93 阅读 · 0 评论 -
SetUp Driver
Managedriver via a common class: Configpublic final class Config { private static final String DEFAULT_BROWSER = "ie"; private static Logger log = LoggerFactory.getLogger(Config.class);...原创 2019-05-20 10:11:34 · 499 阅读 · 0 评论 -
small skill 1
small skill ---> Java + Selenium原创 2017-03-09 14:37:25 · 257 阅读 · 0 评论 -
Handle league tree
Tree structure is same for each championship year. But the id of new year is different withprevious year. So we did not use id to handle this tree instead of DOM Tree. When found elements and try原创 2017-03-13 13:35:16 · 203 阅读 · 0 评论 -
Tool tip
Handle following:原创 2017-03-09 15:27:00 · 278 阅读 · 0 评论 -
How to handle blocking clicks
Compare window.open with window.showModalDialog()Functiondetailwindow.open()是非阻塞式,也可以说非模态窗口window.showModalDialog() 阻塞式模态窗口。阻塞或者模态窗口,只有你把当前窗口关闭后,才能去操作原创 2017-03-09 15:30:32 · 187 阅读 · 0 评论 -
How to set up remote driver
1. Ready for hub&node: Download Selenium-server include: Browser driver: such as IEDriverServer.exe, geckodriver.exe, chromedriver.exe Selenium: selenium-ser原创 2017-03-09 14:55:00 · 235 阅读 · 0 评论 -
send keys by JS
send keys by JSJavascriptExecutor JS =(JavasciptExecutor)driver;Js.executeScript("document.getElementtById('User').value='test'")原创 2019-05-28 17:04:22 · 367 阅读 · 0 评论