I am trying to make a bot to access a website but once I access that website a popup appear so I used this code to try and exit out of itexitpopupbtn = driver.find_element_by_xpath('//*[#id="notice"]/div/div[1]/button') exitpopupbtn.click()
But nothing happens, Could someone please help me.
Related
I am trying to automate a task with selenium, using Firefox.
I wrote all the code, and it worked perfectly with headless=False, but when I changed it to headless=True, it suddenly did not press some of the buttons - the ones that transfers to a different page works, but the other ones (They should be pressed to register to a service) did not (I know they did not work because when I checked if I was registered after running it, I was not - which was not the case with headless=False).
I printed what is written on the buttons which did not work, so I know the program recognises them, and because I was able to get there I know the other buttons got clicked and responded well.
All buttons was specified the same way (I tried both XPath and CSS Selector).
Any ideas for why it happens and how to fix it will be appreciated.
Thanks!
Note: This site requires username and password, so I don't think it would be useful to add a link.
I am using Selenium Via Python. I have selenium opening up a webpage using chrome and logging me in. Then as soon as i click on something else, it logs me out.
For instance. I can run my program to load Reddit.com and log me in. Then as soon as i click to navigate to any post (Whether using selenium to navigate, or stopping my program and clicking on one myself) it logs me out of reddit. I need it to keep me logged in. Anyone have any clue why its logging me out, and how to fix it?
EDIT: Ok, so I think this is only happening "most" of the time. Sometimes it will keep me signed in and i can navigate all around the website without issue. But most of the time it will log me out as soon as i click on anything. Anyone have any ideas what could be causing this?
I am trying to add connections on Linkedin with Selenium.
I am running into a problem when I try to click each "Connect Now" button. There is a small window that pops up and the script isn't able to click the button. I have tried to click the link and then use driver.find_element_by_class_name('button-primary-large ml1').click()
Side question - How do I connect large and ml1?
When I run the code, it is clicking to connect but then it has a problem trying to click "Send Now" which is what the code above is trying to do. What is a good way for me to click the send now button? I am posting pictures to show what I mean.
You can click the button by using
driver.find_elements_by_css_selector('.send-invite__actions button.button-primary-large').click()
Basically I am currently writing a Python Requests program and everything works fine so far, The issue is there is a button on the website that I want to be pressed. Currently the clicking stage is done in selenium which slows the process down completely.
Just like when filling in a form is there anyway to pass a parameter into a URL to click a button?
The button sends a POST command to a URL when clicked however when trying to recreate this in a browser or in python with .post the desired redirect does not happen.
Any help is much appreciated.
I am trying to automate instagram by using selenium and python.
I went till login without any problem.
But after logging in, instagram pops up a window saying "experience the best version of instagram by getting the app" which is a download link of instagram app.
I want to ignore this download pop up window, and having trouble with it
1)no buttons to click, only close(❌) button.
2)xpath of close(❌) button not working
Please help me
And thank you
Since you are saying xpath of close(❌) button not working , you can go try to pass the Escape key to close the pop up window.
In Java
Actions action = new Actions(driver);
action.sendKeys(Keys.ESCAPE).build().perform();
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_ESCAPE);
robot.keyRelease(KeyEvent.VK_ESCAPE);
In Python
webdriver.ActionChains(driver).send_keys(Keys.ESCAPE).perform()
robot = Robot()
robot.press_and_release(Keys.escape)