'How to handle webpage pop-up with VBA and Selenium?

I have a problem with a code that I am developing in VBA. I am trying to access a web page through the Excel macro. This web page is to access a camera connected to my network, due to its brand (Axis), when accessing I have to enter the username and password, and these text boxes appear in a pop-up window. I am using Google Chrome and the Selenium library.

I have no way of finding out their "id" by pressing F12 or by right clicking and pressing "Inspect element" as can be done on the website itself. Finding out their "id" could handle them. It seems that handling pop-up windows is more complicated. I found some information about this, but it didn't help me much.

For now I can open Google Chrome and access the website, but I cannot enter data in this window. I have tried several Selenium functions, such as writing on the active element, but I don't give any results. Any information on this would help me a lot.

These are my few lines of functional code and a image of the pop-up window:

Public Sub OpenUrl()

Dim obj As New WebDriver

obj.Start "chrome", ""
obj.Get ("webpage")

End Sub

The pop-up window



Solution 1:[1]

Use application.sendkeys to interact with the pop up window box. Use this website to learn more what steps you are able to complete:

https://docs.microsoft.com/en-us/office/vba/api/excel.application.sendkeys

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Omar