selenium

How to switch between iframes using Selenium and Python?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-04 08:28:49
问题 I'm trying to make a script to checkout on a Shopify site and I was able to find the iframe for the card number, but was not able to find the iframe for the name on the card (2nd iframe). Is there any way to enter in a value for that iframe? driver.switch_to.frame(driver.find_element_by_tag_name("iframe")) driver.find_element_by_xpath('//input[@autocomplete="cc-number"]').send_keys("1234") driver.find_element_by_xpath('//div[@data-card-field-placeholder="Name on card"]').click() driver.switch

Selenium won't type to textarea and raises ElementNotInteractableException

大憨熊 提交于 2021-02-04 08:28:27
问题 This is the HTML code in question: <textarea rows="1" cols="1" name="text" class=""></textarea> This is my code: msgElem = driver.find_element_by_css_selector("textarea[name='text']") driver.execute_script("arguments[0].click();", msgElem) driver.execute_script("arguments[0].value = 'Whats up mate, how you doin';", msgElem) msgElem.submit() The code executes and nothing happens. I assume it selects the textarea but doesn't type nothing into it? or nothing happens at all. It also finds the

How to click a link within youtube comment using python selenium

六眼飞鱼酱① 提交于 2021-02-04 08:26:31
问题 I'm new to selenium python, I'm trying to click a link in the youtube comment but I don't know what element to use? Can someone help me? thanks . example : <a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/redirect?event=comments&redir_token=ttzJJRuKzz6sJPh8qdMnWStc-958MTU0NjE1NDU4M0AxNTQ2MDY4MTgz&stzid=Ugw6ip_QkzwyJPIq3bp4AaABAg&q=https%3A%2F%2Fjulissars.itworks.com%2F" rel="nofollow">https://julissars.itworks.com</a> link 回答1: To click on the desired

Send whatsapp message to contacts using Python but getting an error: InvalidSelectorException: Message: invalid selector: Unable to locate an element

穿精又带淫゛_ 提交于 2021-02-04 08:25:07
问题 I am trying to send whatsapp message to contacts using Python but getting an error: InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //span[@title = "Me Postpaid"]"} (Session info: chrome=73.0.3683.103) (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Windows NT 6.1.7601 SP1 x86_64) I have used selenium for this and the code is mentioned below: from selenium import webdriver driver = webdriver

Send whatsapp message to contacts using Python but getting an error: InvalidSelectorException: Message: invalid selector: Unable to locate an element

前提是你 提交于 2021-02-04 08:25:07
问题 I am trying to send whatsapp message to contacts using Python but getting an error: InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //span[@title = "Me Postpaid"]"} (Session info: chrome=73.0.3683.103) (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Windows NT 6.1.7601 SP1 x86_64) I have used selenium for this and the code is mentioned below: from selenium import webdriver driver = webdriver

How to make selenium wait before getting contents from the actual website which loads after the landing page through IEDriverServer and IE

人盡茶涼 提交于 2021-02-04 08:21:44
问题 driver = webdriver.Ie("C:\\IEDriverServer.exe") driver.get(testurl) driver.refresh() time.sleep(5) data = driver.find_element_by_id("__content0-value-scr") So I'm trying to find an element by it's id using Selenium (Python) and Internet Explorer, because I'm limited to Internet Explorer due to company regulations. My problem is as follows: on driver.get(testurl) , selenium loads the page but IE first starts up with the IEDriver landing page. Only after that, it loads the requested url. The

org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools error using ChromeDriver Chrome using Selenium and Java

五迷三道 提交于 2021-02-04 08:18:06
问题 I am seeing below error and browser got disconnected between. Its happening only for chrome. Selenium version I am using is: <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.141.59</version> Error stack trace: [1579632222.785][SEVERE]: Unable to receive message from renderer org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools (Session info: chrome=79.0.3945.117) Build info: version: '3.141.59', revision: 'e82be7d358',

python selenium get data from table

为君一笑 提交于 2021-02-04 08:13:31
问题 I am new to selenium and I want to scrape data from https://www.nasdaq.com/market-activity/stocks/aapl I am particularly interested in data from Summary Data section. As an example, I want to scrap the following data: Exchange: NASDAQ-GS Sector: Technology Industry: Computer Manufacturing Here is the part of HTML code from the table that I want to extract: <table class="summary-data__table" role="table"> <thead class="visually-hidden" role="rowgroup"> <tr role="row"> <th role="columnheader"

Cannot find table element from div element in selenium python

╄→尐↘猪︶ㄣ 提交于 2021-02-04 08:13:11
问题 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

How to click a dynamic link with in a drupal 8 website using xpath/css selector while automating through Selenium and Python

三世轮回 提交于 2021-02-04 08:12:12
问题 I am trying to click on an edit tab link, and its in the form of a hyperlink in an unordered list. Here is the HTML: <li><a href="/node/2658/edit" data-drupal-link-system-path="node/2658/edit">Edit</a></li> I have been trying to use driver.find_element_by_link_text('Edit') to find the element, however always get a NoSuchElementException . I have also used the by partial text fxn, with all variations of the html, and receive the same error. There is also the following html I found that