Get Absolute Reference of an Element using Selenium

I am new in Selenium. I am creating a first example where I go to a website (https://mediamarkt.es) and then I search for an specific product. My code is able to get the search ID and put the product name and then search it. Then, I want to get the product price but there is… Read More Get Absolute Reference of an Element using Selenium

AttributeError when trying to use 'find_element_by_class_name' with Selenium in Python

I’m trying to create a tool that auto-types each letter from a specific class on a webpage using Selenium WebDriver. However, I’m encountering an error: AttributeError: ‘WebDriver’ object has no attribute ‘find_elements_by_class_name’ Here is the Python code: from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Edge() driver.get("https://example.com") letters_divs = driver.find_elements_by_class_name("word") for div in… Read More AttributeError when trying to use 'find_element_by_class_name' with Selenium in Python

selenium xpath for the particular tag

what will be the Xpath for this input tag "<input autocapitalize="sentences" autocorrect="off" class="css-1cwyjr8 r-19sur4y r-qklmqi r-1phboty r-1wdu9aa r-ubezar r-16dba41 r-10paoce r-12rqra3 r-13qz1uu" dir="auto" spellcheck="false" type="email" data-focusable="true" value="" style="font-family: inherit;"> >Solution : Try this: //input[@class=’css-1cwyjr8 r-19sur4y r-qklmqi r-1phboty r-1wdu9aa r-ubezar r-16dba41 r-10paoce r-12rqra3 r-13qz1uu’] Or this: //input[@type=’email’]

Selenium Python WebDriverWait Parenthesis Question

user_val = WebDriverWait(browser, 30).until(EC.presence_of_element_located((By.ID, "username"))) Why does EC.presence_of_element_located require two sets of parenthesis? I didn’t see the need for two pair so I removed one of them and the code quite working — I just flew by it like it was a comment. I added them back and it started working again. Just curious as… Read More Selenium Python WebDriverWait Parenthesis Question

selenium has no attribute

from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager driver = webdriver.Chrome(ChromeDriverManager().install()) driver.get("https://www.google.com&quot;) driver.quit() When I try to run this code, I get an error like this: AttributeError: ‘str’ object has no attribute ‘capabilities’ in "driver = webdriver.Chrome(ChromeDriverManager().install())" I was try open google with selenium but I cant open I cant fix it. >Solution : You… Read More selenium has no attribute

Why am I getting TimeoutException in Selenium with Python?

Just started learning Selenium with Python. And no matter how much I change the WebDriverWait, it’s still giving me the TimeoutException. from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC url = ‘https://bbrauncareers-bbraun.icims.com/jobs/search?ss=1&searchRelation=keyword_all&#8217; driver = webdriver.Chrome() driver.implicitly_wait(30) driver.get(url) wait = WebDriverWait(driver, 30) title = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, ‘div.description’)))… Read More Why am I getting TimeoutException in Selenium with Python?

I can't open chrome with a profile

I try to open a tab with a profile but I get this error WebDriver.init() got multiple values for argument ‘options’ from selenium import webdriver from selenium.webdriver import ChromeOptions PATH = "chromedriver.exe" url = "https://web.whatsapp.com/&quot; options = ChromeOptions() options.add_argument("user-data-dir = C:\\Users\\omer\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 1") Driver = webdriver.Chrome(PATH,options=options) Driver.get(url) “` >Solution : You have to use Service… Read More I can't open chrome with a profile

For loop only returns the last row

I have been trying to convert table data extracted using Selenium into Pandas DataFrame. Here is my code: import os import pandas as pd import numpy as np import requests from bs4 import BeautifulSoup as bs import time from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys from… Read More For loop only returns the last row

Sending Text One Character at a time fails with "cannot convert from char to string"

I am trying to send a string one character at a time. When I try the code below it isn’t working. It says Argument 1: cannot convert from char to string. I know this is probably something simple I am not doing, I just can’t think of what it is. public void SelectUnit(string unitStr) {… Read More Sending Text One Character at a time fails with "cannot convert from char to string"