This question already has answers here:
Unable to locate element of credit card number using selenium python
(2 answers)
Closed 3 years ago.
I am attempting to automate the checkout process of a shopify checkout and selenium can't seem to find the elements necessary to complete the checkout. NOTE: This checkout is not in an iframe and i have done extensive research to make sure that the page is fully loaded, so this is not a duplicate question.
try:
elem = driver.find_element_by_id('number')
elem.send_keys('4342923222931029')
except NoSuchElementException:
assert 0, "can't find input with number id"
Here is what i am trying to access: screenshot of the source code of the checkout code
Here is the python code to switch to the correct frame.
ele = driver.find_element_by_xpath("//iframe[contains(id, 'card-fields-number')]")
driver.switch_to.frame(ele);
For Java solution refer here
Related
This question already has answers here:
Open web in new tab Selenium + Python
(21 answers)
Selenium Switch Tabs
(4 answers)
Closed 2 years ago.
sorry that my english grammar is soo bad and still newbie in stackoveflow comunity. Before ask, i already try to find my problem solution but i found dead end and now i try to ask question in stackoverflow
can someone told me how to open link in new tab without create blank new tab, or maybe you can give me suggestion how to make my code better
this is my code :
from selenium import webdriver
#use webdrive
drive=webdriver.Firefox()
#open google and find something
drive.get("https://www.google.com/")
search=drive.find_element_by_xpath('/html/body/div/div[2]/form/div[2]/div[1]/div[1]/div/div[2]/input')
search.send_keys('find something')
tombol=drive.find_element_by_xpath('/html/body/div/div[2]/form/div[2]/div[1]/div[3]/center/input[1]')
tombol.click()
#now you list every website top search google
links=drive.find_elements_by_class_name('r')
#iterate every website and open new tab
i=0
for link in links:
#code to execute link in new tab
#i just found how to click single website
link.click()
This question already has answers here:
Do we have any generic function to check if page has completely loaded in Selenium
(7 answers)
Is there a way with python-selenium to wait until all elements of a page has loaded?
(3 answers)
Closed 2 years ago.
I am scraping 'href' tags from a website while inputting values from a csv file. The issue that I am facing is that the webpage sometimes doesn't get loaded fully and is returning values from the previously loaded webpage. For the same, I want to ensure that the webpage is loaded fully. I am using selenium in python and have used the following query:
links = driver.find_elements_by_xpath("//*[#class='search-result__image-wrapper']/a")
WebDriverWait(driver, timeout).until(links[0])
Basically, the links variable extracts the elements that contain the profile URLs if it exists. There might be cases where "links" is null. The above code gives me the following error:
"WebElement object is not callable"
When I tried using,
links = driver.find_elements_by_xpath("//*[#class='search-result__image-wrapper']/a")
WebDriverWait(driver, timeout).until(links)
The error is:
"TypeError: List object is not callable in python"
Can you please help me with this? I am new to python and web scraping. Thanks!
This question already has answers here:
org.openqa.selenium.ElementNotInteractableException: Element is not reachable by keyboard: while sending text to FirstName field in Facebook
(5 answers)
Closed 2 years ago.
I'm trying to automate uploading a picture on this website.
I tried locating the element and sending the image path.
UploadBtn = b.find_element_by_xpath('/html/body/div[5]/div[2]/div/div/div/div[2]/div/div[2]/div[1]/button[1]/div/div[2]')
path = 'imagepath'
UploadBtn.send_keys(path)
But the problem I'm getting is this:
selenium.common.exceptions.ElementNotInteractableException:
Message: Element <div class="action-button-text"> is not reachable by keyboard
Is there any other way to do it? Or am I doing something incorrectly? Also, please ask me if you want more details about the problem.
I think you just should click the button next
using the UploadBtn.click() method
This question already has answers here:
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable when clicking on an element using Selenium Python
(6 answers)
How to resolve ElementNotInteractableException: Element is not visible in Selenium webdriver?
(6 answers)
Closed 2 years ago.
I am trying to click a button using selenium, i have attached an image of the html code.
so far i have:
browser.find_element_by_css_selector("input[type='radio'][id='SF_SP2_01']").click()
but get error saying:
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
First, see if the advice in this link helps
However, if that does not help, the element you are trying to click may not be in the same frame you are currently in. Check for any < iframe> tags in the html, and if there is one the fix should be something simple like:
driver.switch_to.frame('iframe_here')
Then you will be able to interact with the element.
That is one possible solution, it may not be the correct one for this issue but give it a try.
This question already has answers here:
Log into gmail using Selenium in Python
(2 answers)
Closed 5 years ago.
I'm trying to automatically log into Gmail via a Python script. I'm using the selenium webdriver. I've managed to get my email entered but I don't know how to get my password entered as well. I've already checked past questions on here but the selectors mentioned in the answers don't seem to work. I keep getting an "Unable to locate element" error.
The code I tried:
driver.find_element_by_name("password").send_keys(pw)
You can use wait before if wanted otherwise you can achieve this simlply by ID
Gpassword = driver.find_element_by_id("password")
Gpassword.send_keys("xxxxxxxx")
This should be a comment but I don't have the 50 required rep.
I would try the GMail Python API. It should be a lot easier:
https://developers.google.com/gmail/api/quickstart/python
Make sure the element name is correct
make sure the element is visible (not overlapped by another element. ex: by virtual keyboard (in mobile application) or by auto-complete box)