Adding Connections on Linkedin with selenium and python - python

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()

Related

Python Selemium in Firefox - click button does not work only for headless mode

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.

Trying to click the exit button on a popup using python selenium

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.

How to handle pop up browser ? (using Robot Framework,python)

I am using Robot IDE for creating robot automation test scripts.
For my test the browser is asking for permission to show notification. Since it's a web-based alert dialog I'm not able to access it in my robot script. If I am clicking on the "Allow" button manually then it proceeds to the test and passes successfully. I need to allow the browser to show notification with my robot script.
As you can see from the image I want to click on the Allow button which is necessary to go ahead in my test.
So can anyone know how can I click on the "Allow" button of the browser confirmation popup via the robot test script?
You could just allow or block all the notifications, in this way no pop up will appear
https://support.google.com/chrome/answer/3220216?co=GENIE.Platform%3DDesktop&hl=en
You can disable them using DesiredCapabilities. In this geolocation case, you should use disable-geolocation option.
Here's an example: How can I handle Geo Location popup in browser using selenium webdriver?

Clicking HTML button with URL Parameters?

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.

Handling app download window in selenium using python

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)

Categories

Resources