selenium-webdriver

Selenium webdriver not opening websites in default chrome profile

懵懂的女人 提交于 2020-02-28 23:17:32
问题 I have tried selenium webdriver in Python and it works fine. But when I try to open default chrome profile it doesn't open the websites. The code is chromeOptions = webdriver.ChromeOptions() chromeOptions.add_argument("user-data- dir=/Users/prajwal/Library/Application Support/Google/Chrome") capability = DesiredCapabilities.CHROME capability["pageLoadStrategy"] = "normal" driver = webdriver.Chrome(desired_capabilities=capability, chrome_options=chromeOptions) driver.get("https://www.google

Browser refresh by Ctrl+F5 in WebDriver using Java

帅比萌擦擦* 提交于 2020-02-28 04:23:31
问题 I have refreshed the browser in WebDriver using java as below code: driver.navigate().refresh(); How can I do that by pressing Ctrl+F5 in WebDriver using Java? 回答1: I think you can use the WebDriver and Actions instance as below: Actions actionObject = new Actions(driver); actionObject.keyDown(Keys.CONTROL).sendKeys(Keys.F5).keyUp(Keys.CONTROL).perform‌​(); 来源: https://stackoverflow.com/questions/12299960/browser-refresh-by-ctrlf5-in-webdriver-using-java

How to Minimize browser window in selenium webdriver 3

一曲冷凌霜 提交于 2020-02-27 08:24:30
问题 After maximizing window by driver.manage().window().maximize(); how to minimize browser window in selenium webdriver with java 回答1: Unfortunately, Selenium does not provide any built-in function for minimizing the browser window, there is the only function for maximizing the window. But there is some workaround for doing this. driver.manage().window().setPosition(new Point(-2000, 0)); Please check with this. 回答2: This is a quite old question. But there seems to be a minimize function now:

how to override default set of chrome command line switches in selenium

牧云@^-^@ 提交于 2020-02-27 07:54:17
问题 By default, chrome will be run with this command line: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-hang-monitor --disable-prompt-on-repost --dom-automation --full-memory-crash-report --no-default-browser-check --no-first-run --disable-background-networking --disable-sync --disable-translate --disable-web-resources --safebrowsing-disable-auto-update --safebrowsing-disable-download-protection --disable-client-side-phishing-detection --disable-component-update -

how to override default set of chrome command line switches in selenium

不打扰是莪最后的温柔 提交于 2020-02-27 07:52:25
问题 By default, chrome will be run with this command line: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-hang-monitor --disable-prompt-on-repost --dom-automation --full-memory-crash-report --no-default-browser-check --no-first-run --disable-background-networking --disable-sync --disable-translate --disable-web-resources --safebrowsing-disable-auto-update --safebrowsing-disable-download-protection --disable-client-side-phishing-detection --disable-component-update -

Python selenium: use a browser that is already open and logged in with login credentials

安稳与你 提交于 2020-02-26 06:38:27
问题 Is there a way that for different runs of a python program that uses selenium I keep the browser that I have opened and logged in with my credentials, open and use in later runs? I am debugging a code. On the browser each time I need to log in using my credentials. Currently, everytime I stop the code, the web-browser gets closed. Is there a way to keep a copy of browser that I have already open and logged in open and use it for my later debug so every time I don't need to enter my login

How to execute class in logged in slenium instead of opening new chrome instance?

核能气质少年 提交于 2020-02-25 22:42:29
问题 from selenium import webdriver from time import sleep filename = "log.txt" myfile = open(filename, 'w') class Search(object): def __init__(self): self.driver = webdriver.Chrome('chromedriver.exe') # "This will open a new chrome instance without being logged in to the site" self.driver.get("Site2") sleep(2) self.driver.find_element_by_xpath("/html/body/div[1]/div[4]/div/div/div[3]/div/div/div[2]/div[2]/div[2]/div/div[4]/div[1]/div[2]/div[1]/a").click() sleep(2) Texto = self.driver.find_element

App with Selenium Not Responding - Not showing the progress bar and Not Emitting the text in Console until the task is completed

你离开我真会死。 提交于 2020-02-25 21:51:23
问题 Window title is showing as Not Responding when using PyQt5 and selenium. The progress bar and the console emit stream displays after the completion of execution of script. Need help in getting this fixed. from selenium import webdriver from selenium.common.exceptions import TimeoutException,NoSuchElementException,ElementClickInterceptedException from selenium.webdriver.support.ui import WebDriverWait,Select from selenium.webdriver.support import expected_conditions as EC from selenium

java.io.FileNotFoundException: c:\screenshot.png (Access is denied) error while trying to paste the screenshot to a system folder

人走茶凉 提交于 2020-02-25 16:56:28
问题 public class Automate1 { public static void main(String[] args) throws IOException { System.setProperty("webdriver.chrome.driver","C:\Users\DELL\Downloads\chromedriver.exe"); WebDriver driver=new ChromeDriver(); driver.manage().window().maximize(); driver.manage().deleteAllCookies(); driver.get("https://www.amazon.in"); Select SC=new Select(driver.findElement(By.xpath("//select[@id='searchDropdownBox']"))); //Selecting an option from drop down by using Select class SC.selectByVisibleText(

java.io.FileNotFoundException: c:\screenshot.png (Access is denied) error while trying to paste the screenshot to a system folder

余生颓废 提交于 2020-02-25 16:54:47
问题 public class Automate1 { public static void main(String[] args) throws IOException { System.setProperty("webdriver.chrome.driver","C:\Users\DELL\Downloads\chromedriver.exe"); WebDriver driver=new ChromeDriver(); driver.manage().window().maximize(); driver.manage().deleteAllCookies(); driver.get("https://www.amazon.in"); Select SC=new Select(driver.findElement(By.xpath("//select[@id='searchDropdownBox']"))); //Selecting an option from drop down by using Select class SC.selectByVisibleText(