selenium

Cannot find table element from div element in selenium python

不想你离开。 提交于 2021-02-04 08:11:20
问题 I am trying to select a table values from div element using selenium , When I inspect the element, I could see the element contains the table but I cannot find it while viewing the source code (which is happening while trying to access through selenium). During Inspect: Below is the code I tried, totals = driver.find_element_by_id("totals")#gets the totals div element. Only one is there labels=totals.find_elements_by_class_name("hasLabel")#should get the table rows, but it was empty print(len

Python Selenium SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//div[contains(@class, 'product-card__subtitle')

蹲街弑〆低调 提交于 2021-02-04 08:10:56
问题 Trying to get the XPath of div class and the text inside of the div. the two divs are: <div class="product-card__subtitle">Women's Shoe</div> <div class="product-card__subtitle">Men's Shoe</div> My Xpaths that are giving the selenium error are: driver.find_element_by_xpath("//div[contains(@class, 'product-card__subtitle') and text(" ")='Women's Shoe']") driver.find_element_by_xpath("//div[contains(@class, 'product-card__subtitle') and text()='Men's " "Shoe']") I am trying to get the path for

Open an accordion with selenium in python

别等时光非礼了梦想. 提交于 2021-02-04 08:10:41
问题 I'm trying to open an accordion link with selenium in python. The element looks like this when closed: <div class="crm-accordion-body" style="display: none;"> and this when open: <div class="crm-accordion-body" style="display: block;"> The code I'm trying to use to change the style is: driver.execute_script("document.getElementsByClassName('crm-accordion-body').style.display = 'block';") This produces the following error: WebDriverException: Message: unknown error: Cannot set property

Python Selenium SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//div[contains(@class, 'product-card__subtitle')

帅比萌擦擦* 提交于 2021-02-04 08:09:32
问题 Trying to get the XPath of div class and the text inside of the div. the two divs are: <div class="product-card__subtitle">Women's Shoe</div> <div class="product-card__subtitle">Men's Shoe</div> My Xpaths that are giving the selenium error are: driver.find_element_by_xpath("//div[contains(@class, 'product-card__subtitle') and text(" ")='Women's Shoe']") driver.find_element_by_xpath("//div[contains(@class, 'product-card__subtitle') and text()='Men's " "Shoe']") I am trying to get the path for

How to download multiple files from a site selecting each option of a dropdown using Selenium in python

≯℡__Kan透↙ 提交于 2021-02-04 08:09:29
问题 I am trying to download multiple files from a site using Selenium in python using the following code. from selenium import webdriver import pandas as pd driver = webdriver.Chrome('chromedriver.exe') driver.maximize_window() driver.get('https://www10.goiania.go.gov.br/TransWeb/FuncionariosExportarPopUp.aspx?_=1590514086637') element = driver.find_element_by_id('WebPatterns_wt12_block_wtMainContent_wtcboReferencia') all_options = element.find_elements_by_tag_name("option") selectYear = Select

How to click within the username field within ProtonMail signup page using Selenium and Java

筅森魡賤 提交于 2021-02-04 08:08:40
问题 I'm not able to make it Wright in an username at https://mail.protonmail.com/create/new?language=en. For some reason it cant find or cant klick at "choose username", Can any one help me out? Code trials: public class LaunchApplication { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "C:\\chromedriver_win32\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); int number = 1; String

Getting specific elements in selenium

二次信任 提交于 2021-02-04 08:01:33
问题 I am trying to get the elements displayed as N06D-X N07X R01A-C01 S01G-X01 in the following image: Now, I got something like the WebDriver in this way: who = driver.find_element_by_tag_name("span").find_elements_by_tag_name("p") and get an output like this: [<selenium.webdriver.remote.webelement.WebElement (session="1c044455cf883fdedf6845bcd456bfab", element="0.23338884730774767-2")>] I am working on Mac Catalina and when I type: who.text it returns an empty list for some reason. I got quite

WebDriverException: Message: unknown error: no chrome binary at C:/…/Chrome/Application/chrome.exe with ChromeDriver Selenium and Python

最后都变了- 提交于 2021-02-04 07:54:35
问题 Bit of a Python newbie here... Windows 7 x64 and Python 3.7 I have installed Selenium and the Chrome Webdriver. I'm using: from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Options() options.binary_location = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe' driver = webdriver.Chrome(chrome_options=options, executable_path='C:/python/chromedriver.exe') driver.get('http://google.com/') I'm getting: \python\python.exe C:/py/defectURLS/app

How to open the option items of a select tag (dropdown) in different tabs/windows?

北战南征 提交于 2021-02-04 07:09:06
问题 I'm trying to scrape this website using Python and Selenium, it requires you to select a date from drop-down box then click search to view the planning applications. URL: https://services.wiltshire.gov.uk/PlanningGIS/LLPG/WeeklyList. I have the code working to select the first index of the drop-down box and press search. How would I open multiple windows for all the date options in the drop-down box or go through them one by one so I can scrape it? from selenium import webdriver from selenium

How to open the option items of a select tag (dropdown) in different tabs/windows?

心已入冬 提交于 2021-02-04 07:08:30
问题 I'm trying to scrape this website using Python and Selenium, it requires you to select a date from drop-down box then click search to view the planning applications. URL: https://services.wiltshire.gov.uk/PlanningGIS/LLPG/WeeklyList. I have the code working to select the first index of the drop-down box and press search. How would I open multiple windows for all the date options in the drop-down box or go through them one by one so I can scrape it? from selenium import webdriver from selenium