(Jan-27-2021, 11:52 AM)buran Wrote: [ -> ]Please, don't play stupid or your presence here will not last much longer.
Ok. Is my question "why I am not receiving notification of replies to my message?" also stupid?
Could you answer, please?
(Feb-01-2021, 02:14 PM)snippsat Wrote: [ -> ]If i test recaptcha there is no problem to find the iframe
and click on check box.
[/url].
Thank you, snippsat. My mistake was that in my example I did not notice iframe, which I wrote about earlier.
Since I'm new to Python programming, could you be more specific? Let's see example of your test link (see
captcha-1.jpg).
driver = webdriver.Chrome()
driver.get(“https://www.google.com/recaptcha/api2/demo”)
driver.switch_to.frame(0)
print("--- a ---")
elem_capt = driver.find_elements_by_class_name("recaptcha-checkbox-checkmark")
print("--- b ---")
elem_capt.select()
print("--- c ---")
and the result
Output:
--- a ---
--- b ---
Traceback (most recent call last):
File "F:\_документы OI\_my\проекты\Python\goo_login.py", line 74, in <module>
main()
File "F:\_документы OI\_my\проекты\Python\goo_login.py", line 30, in main
elem_capt.select()
AttributeError: 'list' object has no attribute 'select'
Process finished with exit code 1
So I see the same error as in my main post.
By the way, if I remove "driver.switch_to.frame(0)" I get the same.
So what should I "find" as elem_capt?
Quote:AttributeError: 'list' object has no attribute 'select'
Return a list object to get,so most use it like this.
elem_capt[0].select()
Here my setup with different tests,but has to solve Buster manually.
So most look at links posted that try to bypass Buster solver.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time
#--| Setup
options = Options()
#options.add_argument("--headless")
#options.add_argument('--log-level=3')
options.add_argument("user-data-dir=cookies") # Try so save cookies local
options.add_argument('--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36')
options.add_argument("--disable-blink-features")
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
browser = webdriver.Chrome(executable_path=r'C:\cmder\bin\chromedriver.exe', options=options)
#--| Parse or automation
browser.get('https://www.google.com/recaptcha/api2/demo')
# Find iframe
captcha_iframe = WebDriverWait(browser, 10).until(ec.presence_of_element_located((By.TAG_NAME, 'iframe')))
# Move to element
ActionChains(browser).move_to_element(captcha_iframe).click().perform()
# Click on checkbox
captcha_box = WebDriverWait(browser, 10).until(ec.presence_of_element_located((By.ID, 'g-recaptcha-response')))
browser.execute_script("arguments[0].click()", captcha_box)
time.sleep(30) # Time to solve
send = browser.find_elements_by_css_selector('#recaptcha-demo-submit')
send[0].click()
(Feb-03-2021, 04:11 PM)snippsat Wrote: [ -> ]Quote:AttributeError: 'list' object has no attribute 'select'
Return a list object to get,so most use it like this.
Here my setup with different tests, but has to solve Buster manually.
So most look at links posted that try to bypass Buster solver.
Thank you, but for me this is strange and complicated example.
Try to open link manually, check captcha checkbox, press button and you'll see "check is successfull".
No need for Buster solver. But your code provoke (execute_script) all those buster pictures!
In my example no buster, I need only check captcha checkbox - when I do it manually.
So my question is - how to imitate THIS user action?
An alternative solution would be to use a python program after manual login - is this possible?
elem_capt[0].select()
doesn't work because list is zero-length
(Feb-04-2021, 01:16 PM)straannick Wrote: [ -> ]Try to open link manually, check captcha checkbox, press button and you'll see "check is successfull".
No need for Buster solver. But your code provoke (execute_script) all those buster pictures!
In my example no buster, I need only check captcha checkbox - when I do it manually.
There is usually no need when do it yourself in browser.
There is a difference when try from Selenium,then dos then Buster solver always show up.
That why you see i try different stuff to hide that i use Selenium.
So if fix your code that do work,you will see that the Buster solver pop up.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import time
#--| Setup
options = Options()
#options.add_argument("--headless")
#options.add_argument('--log-level=3')
# Your path to chromedriver.exe most be in Windows environment Path or same folder as run script
driver = webdriver.Chrome(executable_path=r'C:\cmder\bin\chromedriver.exe', options=options)
#--| Parse or automation
driver.get('https://www.google.com/recaptcha/api2/demo')
time.sleep(2)
# Switch to recaptcha frame
frames = driver.find_elements_by_tag_name("iframe")
driver.switch_to.frame(frames[0])
time.sleep(2)
# Click on checkbox to activate recaptcha,Buster pop up
driver.find_element_by_class_name("recaptcha-checkbox-border").click()