selenium-webdriver

Can't find a way to scrape the resultant table after search using Selenium through Python

与世无争的帅哥 提交于 2021-02-08 08:20:37
问题 I've been doing webscrape with BeautifulSoup, Selenium and Scrapy for a few months, mainly for research purposes. After up and downs I always managed to achieve my web-scraping objectives (a lot of them thanks to this site) until I face this site 'https://euclid.eba.europa.eu/register/cir/search' the page uses javascript and needs to be rendered in order to get the results. With selenium, I managed to click on Continue, Select EEA-Brach type and click on search but after getting the page

Send Ctrl+f python selenium chrome

僤鯓⒐⒋嵵緔 提交于 2021-02-08 07:56:39
问题 I am able to use some keys like Tab browser.find_element_by_tag_name('body').send_keys(Keys.TAB) But not Ctrl + f or Ctrl + p browser.find_element_by_tag_name('body').send_keys(Keys.CONTROL +'f') I also tried using xpath find_element_by_xpath & send_keys(Keys.CONTROL,'f') but still not working 回答1: You shall try by using action_chains in selenium webdriver from selenium.webdriver.common.action_chains import ActionChains # # Your code # browser.find_element_by_tag_name('body') ActionChains

Send Ctrl+f python selenium chrome

▼魔方 西西 提交于 2021-02-08 07:56:10
问题 I am able to use some keys like Tab browser.find_element_by_tag_name('body').send_keys(Keys.TAB) But not Ctrl + f or Ctrl + p browser.find_element_by_tag_name('body').send_keys(Keys.CONTROL +'f') I also tried using xpath find_element_by_xpath & send_keys(Keys.CONTROL,'f') but still not working 回答1: You shall try by using action_chains in selenium webdriver from selenium.webdriver.common.action_chains import ActionChains # # Your code # browser.find_element_by_tag_name('body') ActionChains

How to combine execute_scipt and WebdriverWait

别说谁变了你拦得住时间么 提交于 2021-02-08 07:42:38
问题 I wonder if there is a way to combine execute_script() and WebdriverWait . Currently I have the following code: network_list = driver.find_element_by_xpath('//*[@id="folder_box"]/div[1]/div/div[2]/div[1]') wait = WebDriverWait(driver, 4) try: wait_network_list = wait.until(EC.element_to_be_clickable((By.XPATH, 'network_list'))) except: driver.execute_script("arguments[0].click();", network_list) The code does what it's supposed to do, but I guess this is a ugly way. Is there a way to combine

How do I include screenshot in python pytest html report

我的未来我决定 提交于 2021-02-08 05:17:45
问题 When I hit the below url in browser "https://192.168.xx.xxx/Test/ScreenCapture" I get the screenshot of the device screen under test in the browser. How do I add the screenshot in my pytest html test report. Currently I am using below code which captures screen shot in the test directory specified. url = 'https://192.168.xx.xxx/Test/ScreenCapture' driver.get(url) driver.save_screenshot('/home/tests/screen.png') I am running my pytest with below command : py.test --html=report.html --self

select randomly from dropdown list?

大城市里の小女人 提交于 2021-02-08 04:51:16
问题 My html sample code is, <div class="list"> <div class="dropdown"> <ul role="menu"> <li class="rsbListItem">one</li> <li class="rsbListItem">two</li> <li class="rsbListItem">three</li> <li class="rsbListItem">four</li> <li class="rsbListItem">five</li> <li class="rsbListItem">six</li> <li class="rsbListItem">seven</li> <li class="rsbListItem">eight</li> </ul> </div> </div> How can i write Selenium scripts for this, and each time when i run it should select randomly. I have tried to pick random

Using QtWebDriver to create Qt's automated tests

我只是一个虾纸丫 提交于 2021-02-08 03:59:52
问题 I would like to create automated tests for a Qt's app with selenium + QtWebDriver . I have read the QtWebDriver's wiki , and some questions on stackoverflow like this one However, I'm still not able to use QtWebDriver . I don't understand how to link selenium and QtWebDriver together. there are a lot of questions that I can't answer. How can I use Python to create automated tests for my own Qt's App based on selenium + QtWebDriver ? How can I link my Qt's app with selenium + QtWebDriver ?

Cannot open a newtab in selenium webdriver on Mac OS X

て烟熏妆下的殇ゞ 提交于 2021-02-08 03:40:26
问题 I should be able to open a new tab in selenium for python using the code from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Firefox() driver.get("http://stackoverflow.com/") body = driver.find_element_by_tag_name("body") body.send_keys(Keys.COMMAND + 't') But no new tab opens, and no error message appears (http://stackoverflow.com/ does load). Note that I am using Keys.COMMAND + 't' because I am running the code on OS X. I have no idea what is

Selenium - cant get text from span element

≯℡__Kan透↙ 提交于 2021-02-08 03:34:45
问题 I'm very confused by getting text using Selenium. There are span tags with some text inside them. When I search for them using driver.find_element_by_... , everything works fine. But the problem is that the text can't be got from it. The span tag is found because I can't use .get_attribute('outerHTML') command and I can see this: <span class="branding">ThrivingHealthy</span> But if I change .get_attribute('outerHTML') to .text it returns empty text which is not correct as you can see above.

Finding elements by CSS selector with ChromeDriver (Selenium) in Python

允我心安 提交于 2021-02-08 03:06:54
问题 I'm using ChromeDriver of Selenium with Python and I'm trying to find a button on my page that has the following HTML: <input id="j_id0:SiteTemplate:j_id255:new" type="submit" name="j_id0:SiteTemplate:j_id255:new" value="New" class="kbutton-white"> The only thing I know being constant is the id and name ending with "new" and I'm trying to use the following code to identify and click that element: test_runner.driver.find_element_by_css_selector('[id*=new]').click() However, I get this error