Can anyone send keys to this input field with selenium ? (Selenium Detected) - python

I am just trying to send keys to #inputPlaylist text field in this website https://youtubemultidownloader.net/playlists.html, but selenium is detected in someway.
I tried the most famous driver arguments and JS scripts but in vain.
Can anyone handle this website ?

#Othman Alkhatib, I tried the following and it is working. Let me know if this is what you were looking for. The last line time.sleep(5) is kept just so that anyone running this can see what is happening before the browser gets closed:
import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
chrome_options = Options()
s = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(options=chrome_options, service=s)
driver.get("https://youtubemultidownloader.net/playlists.html")
driver.find_element(By.ID, "inputPlaylist").send_keys("ABC")
time.sleep(5)

Related

Coockie,Web-Telegram, Auto-Auth

I need my cookies to be accepted and used after logging in, and to be checked for validity and, if not valid, to be updated again when I start the program.
The site is https://web.telegram.org/
How do I do this?
I found a kind of cookie authorization checker.
The link is https://telegram.me/_websync_?authed=1&version=1.7.1%20K
I don't understand how to do it.
My code:
import requests
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
options.add_experimental_option("detach", True)
driver = webdriver.Chrome(options=options, service=Service(ChromeDriverManager().install()))
driver.maximize_window()
driver.get('https://web.telegram.org/k/##MOWALY')
I don't see how it can be done.

Trying to scrap the website using selenium but getting this error

type hefrom selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_experimental_option("detach", True)
s=Service('I:\chromedriver_win32\chromedriver.exe')
path='I:\chromedriver_win32\chromedriver.exe'
#Website to scrap
website='https://www.adamchoi.co.uk/overs/detailed'
driver=webdriver.Chrome(service=s,options=chrome_options)
driver.get(website)
#Locating and clicking an element
all_matches_button=driver.find_element(by='xpath',value="//label[normalize-space()='All matches']").click()
matches=driver.find_elements(by="xpath",value='tr')
for match in matches:
print(match.text)
Error:"USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)" and "Bluetooth: bluetooth_adapter_winrt.cc:1074 Getting Default Adapter failed."
A soultion to my problem
how did you get usb error and bluetooth? whats going on?
type hefrom selenium import webdriver where from you copy pasted?
variable all_matches_button never used in your code and there is no need to save anything to variable when click on element.
#Locating and clicking an element
all_matches_button=driver.find_element(by='xpath',value="//label[normalize-space()='All matches']").click()
here is working code to start dig deeper
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_experimental_option("detach", True)
website = 'https://www.adamchoi.co.uk/overs/detailed'
driver = webdriver.Chrome(options=chrome_options)
driver.get(website)
sleep(4)
tr_elements = driver.find_elements(By.XPATH, "//tr")
for tr in tr_elements:
print(tr.tag_name, tr.get_attribute('textContent'))
however, this message shouldn't prevent you from getting scraping result. try to correct your xpath in the last line by adding slashes
matches=driver.find_elements(by="xpath",value='//tr')

Using Selenium with Python not working in google chrome

i have code it opens website in chrome for this code but it does not go further
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome("C:\Drivers\chromedriver_win32 (2)\chromedriver.exe")
driver.get('https://opensource-demo.orangehrmlive.com/web/index.php/auth/login')
driver.find_element("username").send_keys("Admin")
driver.find_element("password").send_keys("admin123")
driver.close()
Result this one
i need answer how to solve this problem
The way you are initializing your webdriver and selecting the input elements seem to be the problem.
Try doing it this way instead.
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
import time
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get('https://opensource-demo.orangehrmlive.com/web/index.php/auth/login')
time.sleep(3)
driver.find_element(By.XPATH, "//input[#name='username']").send_keys("Admin")
driver.find_element(By.XPATH, "//input[#name='password']").send_keys("admin123")
time.sleep(3)
driver.close()
You may also check out selenium's quick start guide here

python selenium sendkey doesn't work in chrome

I'm trying to launch some browser (Chrome) functions by sending shortcuts
I have tried several methods but they all cannot work.
I do this by following these steps
Initialize the browser
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver import ActionChains
options = Options()
options.add_argument("--user-data-dir="+r"path_to_user_data")
options.add_experimental_option("excludeSwitches", ["enable-logging"])
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install())
,options=options
)
Through actionchain
ActionChains(driver).key_down(Keys.CONTROL).key_down('T').key_up('T').key_up(Keys.CONTROL).perform
Through send_key
driver.find_element(by=By.XPATH,value="/html/body").send_keys(Keys.CONTROL+"T")
But it doesn't work. This is confused for me. Why it cannot work?
It is possible to open a new tab and switch to it with a single command
driver.switch_to.new_window()
To Open a blank new tab you can use the below:
driver.execute_script("window.open('');")
Switch to the new window
driver.switch_to.window(driver.window_handles[1])

Module selenium.webdriver has no attribute "get"

I've been trying to run a script in Python to make Chrome open up to a specific page. Here is my code so far
Code part 1
Code part 2
The code is
from selenium import webdriver as wd
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
Then
driver = wd.Chrome()
driver.implicitly_wait(5)
Then
driver.get("https://www.facebook.com")
Despite the error message in the screenshot after the second cell, Chrome opens when I run the script. It just opens to a blank page. I've tried changing the name of driver and wd and webdriver and I get the "module selenium.webdriver has no attribute "get"" every time. This post from yesterday is similar to what I'm having trouble with
but the solution isn't working for me.
Not sure, but try one of the following:
remove wd as it causing misleading
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
driver = webdriver.Chrome()
driver.implicitly_wait(5)
or this
from selenium import webdriver as wd
from webdriver_manager.chrome import ChromeDriverManager
driver = wd.Chrome(ChromeDriverManager().install())
driver = wd.Chrome()
driver.implicitly_wait(5)
But please don't mix between them.
I prefer the first option.

Categories