I need to scrape a name and phone number that appears when clicking a button in a popup.
I was able to complete these steps:
Navigate through the site
Click on "Ver teléfono" option. This opens a popup
Fill the form
Click on "Enviar" option. This shows a loading gif and nothing else happens
Here is the used code: https://www.mycompiler.io/view/6ukTEftFwyh
The expected result (tested outside selenium) is that the popup shows the name and phone number after clicking the "Enviar" option
Related
I have a code in python that uses selenium chromedriver to reach a webpage and collect some data but I want to solve a issue related with a pop-up window. For example, if you go to this webpage https://finance.yahoo.com/quote/BAC?p=BAC you will get two pop-up windows. One is for the acceptance of the collection of personal data (image below) and this I can handle well with the following code:
...
# Go to the website:
driver.get(main_url)
# Click accept button
driver.find_element(By.NAME, "agree").click()
...
The second one (image below) however I'm not being able to dismiss. I want the code to click on the "Maybe later" button but I cant find the button ID. Can someone help me?
On Python 3.9 and Selenium 4.00
Hi there, I'm currently trying to automate downloading a few things on Chrome. I got the login part and navigating to the page down and it works properly. I'm having issues with the next part which is clicking "export" then "export as csv". I hover over the HTML source code and it highlights the buttons I need to press so I hit "copy XPath" but selenium won't press it and I get this error.
Edit: I cannot share the site as it is locked behind a login and it is not my login to give out; end of edit.
Message: invalid selector: Unable to locate an element with the xpath expression //*[#id="report_nav_menu"]/ul/li[2]/a"
Here's my code
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get('website')
driver.find_element(By.XPATH, '//*[#id="report_nav_menu"]/ul/li[2]/a').click()
time.sleep(1) # makes sure the page loads
driver.find_element(By.XPATH, '//*[#id="report_nav_menu"]/ul/li[2]/ul/li[6]/a').click()
time.sleep(1000) # to keep the browser open
This the is HTML source code:
Source code
The first highlight in the pic is for the Export button.
Need to click this first
The second highlight shows that it's for the CSV button.
Need to click this second
//class[#elname="zc-navmenuEl/button[2] seems to be an invalid XPath expression.
I can't see this locator used in the code you presented in the question.
Also you didn't share an URL of the page you are working with so I can't determine the correct element locator.
Here are my steps
1.Using selenium webdriver I am opening Edge
2.Then after click a link it opens popup security window. I am attaching a screenshot
3. I tried to switch that window using many different ways. It is not an alert because when I called for alert it says no such alerts are open.
I tried to call following but it gives error
window_after = driver.window_handles[1]
Following two lines gave me 1 handles:
handles = driver.window_handles
print("Number of handles ", len(handles))
Output:
Number of handles 1
if it is not alert, not a window, what is it? view source code does not print anything.
All i need is insert user name and password and then click "OK" button
I put the program for sleep 20 seconds and then manually selected the cursor to user name text box. The executed following code but it does nothing
ActionChains(driver).send_keys("Test").perform()
Side Note: Need answer for only for Microsoft Edge.
Selenium only works for browser automation. The Windows Security pop-up is an OS-level dialog and Selenium will not be able to recognize it. You could use third party tools like AutoIt with Selenium to automate non-browser based functionality. For the detailed steps, you could refer to this article.
After closing a pop-up window, my code somehow does not recognize changed screen.
Short description: I press button, pop-up shows up that my "Camera is offline", I press OK, and then I am waiting until page has "Add new camera" written on here. In my screen it shows up, when I try to debug it also shows that this keyword is in page, but my test fails.
I tried to change elements which to wait till it shows.
I tried to use sleep function.
I have another places that the code does not work - when I close pop-up window, my code does not recognize new page.
Click Element com.yummiapps.eldes:id/a_add_camera_b_add #add button to get a pop-up window
Wait Until Page Contains Camera is offline and cannot be added #waiting till pop-up shows
Click Element com.yummiapps.eldes:id/d_e_b_ok #clicking on button from pop-uo
Wait Until Page Contains Add new camera #afte closing pop-up this segment always fails
Last code line should recognize that page is refreshed and it contains string "Add new camera"
pop-up window
after closing pop-up
I've written a code with selenium and pyautogui to click around on a website and be able to click the save button with pyautogui after the download button has been clicked with selenium. I wanted to know if it was possible to click the saveas button instead and change the file name with python.
the code I have:
driver.find_by_element_by_xpath("//a[#id='Ribbon.Library.Action.ExportToSpreadsheet-Medium']").click()
saveButton = pyautogui.locateCenterOnScreen("C:\\User\\Documents\\savebutton.jpg")
pyautogui.click(position[0], position[1])
so what this does is click the download button and then compares the picture of the button and clicks the save option. But theres an arrow on the button to click saveas and that's what I need to click so I can choose the destination to save it and change the name of the file. Was wondering if there is a way to do this.
the button looks like this
also I am downloading from Edge, I'm not looking to use chrome or any other browser.