webdriver

What is the difference between SearchContext and WebDriver interfaces in Selenium or what is the relationship between them?

孤街醉人 提交于 2020-08-20 10:51:07
问题 I have seen somewhere we can use both WebDriver driver = new FirefoxDriver() or SearchContext driver = new FirefoxDriver() I am confused what is the difference between these two different interfaces? 回答1: SearchContext SearchContext is an interface which is the runtime container for contextual information for applications search. It contains search related meta information and can hold the reference to an external context that might be useful for the purpose of search as well as security.

selenium.common.exceptions.WebDriverException: Message: unknown error: 'script' must be a string while using execute_script() through Selenium Python

房东的猫 提交于 2020-08-20 06:48:07
问题 I've got an issue with browser.execute_script while using selenium with python. There is an element that i'd like to click (it's xpath below) "//*[@id='listFav_FI410_23244709400000_FAGNNURROR_IPOF_APP_P43070_W43070A_CP000A001_40']/table/tbody/tr/td[1]" I try to do it with: navMenu = browser.find_element_by_xpath("//*[@id='listFav_FI410_23244709400000_FAGNNURROR_IPOF_APP_P43070_W43070A_CP000A001_40']/table/tbody/tr/td[1]") time.sleep(3) browser.execute_script(navMenu.click()) And it works (So

Python 3.5 - Selenium - How to handle a new window and wait until it is fully loaded?

女生的网名这么多〃 提交于 2020-08-19 17:54:00
问题 I am doing browser automation and I am blocked at a certain point: at a moment, I ask the browser to click on a button, which in turn open up a new window. But sometimes the Internet is too slow, and so this new window takes time to load. I want to know how can I ask Selenium to wait until this new fresh window is fully loaded. Here's my code: driver.switch_to.default_content() Button = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, 'addPicturesBtn'))) Button.click()

Python 3.5 - Selenium - How to handle a new window and wait until it is fully loaded?

偶尔善良 提交于 2020-08-19 17:52:17
问题 I am doing browser automation and I am blocked at a certain point: at a moment, I ask the browser to click on a button, which in turn open up a new window. But sometimes the Internet is too slow, and so this new window takes time to load. I want to know how can I ask Selenium to wait until this new fresh window is fully loaded. Here's my code: driver.switch_to.default_content() Button = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, 'addPicturesBtn'))) Button.click()

Selenium Error: This version of ChromeDriver only supports Chrome version 81

扶醉桌前 提交于 2020-08-10 05:48:07
问题 I am getting an error when opening up chrome with Selenium, it opens up and closes the window right after opening. Here is my code: import requests import json from selenium import webdriver driver = webdriver.Chrome(executable_path=r'C:\Users\Salvatore\Desktop\Desktop\webdrivers\chromedriver.exe')``` This is the error: ```selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81``` 回答1: Please check which

Can I test on the order of elements using Selenium Webdriver?

我们两清 提交于 2020-08-08 07:21:20
问题 There is a form in which there are 3 fields with 3 different ID's: <fieldset> <div><label for="field1"> FIELD1 </label> <textarea id="field1" name="field1" rows="10" cols="40"></textarea></div> <div><label for="field2"> FIELD2 </label><textarea id="field2" name="field2" rows="10" cols="40"></textarea></div> <div><label for="field3"> FIELD3 </label><textarea id="field3" name="field3" rows="10" cols="40"></textarea></div> </fieldset> Now, there is a Story in our scrum process which places