This exercise will present a popup dialogue asking for your credential (which is admin, admin as shown in the exercise). This popup is not an alert nor an iframe, the only way is to include the username and password with the address to get through it with selenium. This is the original state after the … Continue reading [selenium] Handling authentication popup
Tag: python3
[selenium] Simulate right click.
Selenium works on web elements, so any browser's function selenium cannot automate. On this exercise, right click within the dotted box area will trigger a JS alert which says "You selected a context menu". To simulate right click with Selenium: First find the element of the dotted box, then use ActionChains to move to the … Continue reading [selenium] Simulate right click.
[selenium] Dropdown box selection
Selenium is about finding the elements to do action upon, the dropdown box exercise can be found here. From the web developer tool of your selected browser find the element of option1 and option2 and copy their xpaths, xpath is the most accurate for selenium to act upon, my preference is always xpath then next … Continue reading [selenium] Dropdown box selection
[selenium] Solution to HTML5 drag and drop with python
Selenium is a great web app automation tool which have several variants, I am using python to implement selenium on this https://the-internet.herokuapp.com/drag_and_drop, Selenium has an ActionChain that can do drag and drop, but this is not working in HTML5, the solution in another language (perhaps is ruby?) can be found here. I have converted the … Continue reading [selenium] Solution to HTML5 drag and drop with python
[python]Hand made cryptography with XOR method.
ord function is to convert a character to its equivalent integer representation. chr function is to convert the integer to its character representation. random.choice() method randomly picks a character from a series of characters to form a string of N length, this is the key for encryption and decryption. A message is taken from user's … Continue reading [python]Hand made cryptography with XOR method.
[python]Argparser
I do not like to write a python cli that accepts argument as I am an advocate of using wizard style to guide user on how to configure things easily. But it seems the time has come for me to write a CLI script in python, and in order to provide usage guide and data … Continue reading [python]Argparser
[python]Checking if all keys in dictionary exist
There is a chance when you need to verify all params in the dictionary are present before submitting a post request to an API server. This is one of the solution which I am using: The use of all function evaluates an iterable and returns true if all elements are true.
[python] Improving get_project_dirs method of SSHClient subclass
I noticed I did not have enough testing on my code for getting directories under base project directory. This is part of the code snippet of my SSHClient subclass: The problem The method gets all things under the base directory that is files and directories, that is because I have sliced and diced too much … Continue reading [python] Improving get_project_dirs method of SSHClient subclass
[python]Paramiko’s SSHClient
Paramiko SSH client I wrote a sub class from paramiko in order add on functionality to assist myself to work with Ansible AWX 9.2.0 (dockerless version). The subclass works with my CentOS which hosts the Ansible AWX, the purpose is to use the SSHClient class to download and upload playbooks, check the existence of project … Continue reading [python]Paramiko’s SSHClient
[python]Check site availability and whether the site has https
I have a dev server which is running with http, however to minimise the need to change the code, I want to write a function to check. Here's an example: