Skip to content

Instantly share code, notes, and snippets.

View ValchanOficial's full-sized avatar
:octocat:
Happy Octocat

Valéria Padilha de Vargas ValchanOficial

:octocat:
Happy Octocat
View GitHub Profile
//System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
//ChromeOptions options = new ChromeOptions();
//options.addArguments("start-maximized");
//options.addArguments("disable-infobars");
//options.addArguments("--disable-extensions");
//options.addArguments("--disable-gpu");
//options.addArguments("--disable-dev-shm-usage");
//options.addArguments("--no-sandbox");
//driver = new ChromeDriver(options);
@ValchanOficial
ValchanOficial / gist:98835c6862e3527d12f2a99b1d00e115
Created July 5, 2018 16:41
selenium-webdriver-click-on-hidden-elements
https://stackoverflow.com/questions/12363038/selenium-webdriver-click-on-hidden-elements
WebElement elem = yourWebDriverInstance.findElement(By.xpath("//*[@class='goog-menu goog-menu-vertical uploadmenu density-tiny']/input"));
String js = "arguments[0].style.height='auto'; arguments[0].style.visibility='visible';";
((JavascriptExecutor) yourWebDriverInstance).executeScript(js, elem);
The above bunch would change the visibility of your file input control. You can then proceed with the usual steps for file upload like:
elem.sendKeys("<LOCAL FILE PATH>");
public WebElement metodo() {
WebElement element = driver.findElement(By.className("ID"));
String js = "arguments[0].style.height='auto'; arguments[0].style.visibility='visible';";
((JavascriptExecutor) driver).executeScript(js, element);
return element;
}
public WebElement metodo() {
WebDriverWait wait = new WebDriverWait(driver,10);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("ID")));
return element;
@ValchanOficial
ValchanOficial / gist:96e73fc1118abeb457ad2954b790a90f
Created July 10, 2018 18:18
Scroll UP or Down a page in Selenium Webdriver
https://www.guru99.com/scroll-up-down-selenium-webdriver.html#2
https://stackoverflow.com/questions/12293158/page-scroll-up-or-down-in-selenium-webdriver-selenium-2-using-java
For Scroll down:
WebDriver driver = new FirefoxDriver();
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("window.scrollBy(0,250)", "");
OR, you can do as follows:
jse.executeScript("scroll(0, 250);");
@ValchanOficial
ValchanOficial / gist:5b6b5cf6b9379a456070d2297dd94019
Created July 10, 2018 18:22
Validate Downloaded file after clicking on downloaded button/ link
https://stackoverflow.com/questions/45573483/how-to-check-downloaded-files-selenium-webdriver
http://www.seleniumeasy.com/selenium-tutorials/verify-file-after-downloading-using-webdriver-java
https://stackoverflow.com/questions/30726126/detecting-a-file-downloaded-in-selenium-java
public class FileDownloadVerify {
private WebDriver driver;
private static String downloadPath = "D:\\seleniumdownloads";
private String URL="http://spreadsheetpage.com/index.php/file/C35/P10/";
@ValchanOficial
ValchanOficial / gist:395058e91cc1bd8a546d89a568082253
Created July 10, 2018 19:58
Getting Started with WebDriver C# in 10 Minutes
https://www.automatetheplanet.com/getting-started-webdriver/
@ValchanOficial
ValchanOficial / gist:6dfcd146178479b847e42d69e7f38206
Created July 12, 2018 21:02
Error from selenium IDE: The URI scheme corresponds to an unknown protocol handler
https://stackoverflow.com/questions/33672227/error-from-selenium-ide-the-uri-scheme-corresponds-to-an-unknown-protocol-handl
[error] Unexpected Exception: [Exception... "The URI scheme corresponds to an unknown protocol handler"
Use the filepath: file:///C:/Folder/test.ext
C:\Folder\test.xml
or
C:\Folder\test.html
@ValchanOficial
ValchanOficial / gist:1356f45ed98ac4c37cf48cad140eaa31
Created January 17, 2019 16:34 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
** ------------------------ HTML ------------------------ **
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
https://blog.webjeda.com/instant-jekyll-search/
DEMO: https://blog.webjeda.com/demo/instant-jekyll-search/