Handling app download window in selenium using python - 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)

Related

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?

Adding Connections on Linkedin with selenium and 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()

Selenium Web driver is not able to find the div class in Google Chrome webstore

I want to crawl some data from Google Chrome Website. But I am facing a problem whenever trying to use selenium webdriver. When I use following code I get an error stating that this element doesn't exist in the site.
button = driver.find_element_by_class_name("a-d-l-L")
Snapshot of the website:
And also, how to get data from a pop up window (this window comes up when I press a button). Following screen can be found on the next page. I want to store the data that is showing in the pop up message.
Google has special permissions on the Chrome Webstore, as of now you can't use Selenium to automate any page on the Chrome Webstore website.

How to use pywinauto and selenium for login purpose?

I tried to write code to login using pywinauto and selenium, but my script is getting failed. I tried to find solution, but it seems there is no much info available on this.
from pywinauto import application
from selenium import webdriver
driver=webdriver.Chrome()
app=application.Application()
driver.get("https://google.co.in")//url for google only as an example
app = application.Application()
app.connect(backend="uia") // getting issue in this line, what to write under bracket to connect to opened browser?
app.window_().TypeKeys('username') // Is this proper way to type text in authentication window username field where cursor blinks by default?
I am getting below error message
pywinauto.findwindows.ElementAmbiguousError: There are 6 elements that
match the criteria {'backend': u'win32'}
Note : For login to my application, windows authentication popup appears which cannot be handled in selenium, so need to handle it using other tool. I had a solution to it earlier which is not working now, I had asked it here Windows authentication code no longer working now
The steps your need are; open the page, find the elements you want to interact with (such as login text box) then type your input. This can all be done in selenium. Check out the documentation:
http://selenium-python.readthedocs.io/navigating.html#interacting-with-the-page

Categories

Resources