Selenium Python quick note.
Let’s say you have a form that you have to populate. If you execute send_keys(“5”) then send_keys(“5”) again a bit later before submitting form, it will populate “55” in the input field. It will not replace the existing 5 with a new 5. You first have to .clear() to do that.
Above example produces “55”
Above example produces “5”
Noticed this after updating to PyCharm 2017.1. We ran some of our tests by right clicking on a top level folder then selecting “Run Nosetests in ..” from the right click menu. This does not work any more as the right click option is missing, unless you have tests in all subfolders.
Here is a workaround that worked for me. I do not necessarily recommend it, but it does the job: Place a fake test file in the top level directory. I tried in several combinations but it seems like just placing in top level directory that you want to run from is enough. Try it. If not, then place in all subfolders.
This is how my fake_test.py looks like. When running, it completes in 1ms so not a time hog.
Below are also some images to illustrate the point better. I have three levels of folders. I captured the screenshot of right click menu for low/mid/top level folders. Only the low level has a real test file. The others do not. By placing a fake_test.py file in the mid level, one can run tests from UI from the mid level right click menu. In the last image you can also see that the menu option “Run Nosetests in ..” is missing from the top level as it does not have any test files.
Hope this helps someone.
There is a method for that.
“EC.element_to_be_clickable” comes in handy.
In below example, the Continue button would not get enabled until the form fields were filled in properly. Sometimes the test would whiz through too fast and the click of the Continue button would fail. This way, it waits for it to be clickable. Nice.
You will need to import a few items and instantiate:
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
wait = ui.WebDriverWait(self.driver, 10)
Similar to an earlier post. Syntax is the same as for Sublime Text.
- Open the Search and Replace boxes.
- Click on the RegEx icon
- In the search field, enter :
- Then in the Replace field, enter:
- This will surround your existing lines with chocolate and cookies.
- These captures might help
Install the validictory Python module : https://github.com/jamesturk , /validictory/ http://validictory.readthedocs.io
Generate the JSON schema for validation based on the unique JSON from your endpoints : http://jsonschema.net
Compare the schema vs the returned JSON. Sample:
except ValueError, error:
self.fail("that did not work out")
I’ll add some validictory snippets when I get around to it.
Visual Studio Code has all of the features I currently need and it’s fast. It’s becoming my editor of choice. I have used Notepad++, Sublime and Atom in the past. Currently, VS Code is in the lead.
- nice dark theme
- plenty of extensions
- easy to configure and run scripts from editor
- syntax checking, highlighting
- find and select next instance of text
- duplicate text/line, move lines, multiple cursors, block edit
- find/replace with Regex
One thing that I would like is a nice remote editing tool like NppFTP.
It should not take five days and multiple calls to support lasting over six hours to set up a family account.
The long/short story : I had one icloud account set up on a Mac. It had my credit card information. My wife had another icould account set up on her iPod (completely normal) but she had a different credit card number entered for purchases. When I created a family account I was able to add all family members through the interface. However, when I joined Apple Music paid membership, only I was able to use the “pro” features. None of my family members were. Support had me jump through all the hoops:
- delete family
- add family
- I was told after changing the settings to wait up to 2 days for the change to kick in? That was hilarious.
- restart iPod, iPad, iPhone, MacBook multiple times
- log out and log in probably at least sixty times across 5 devices
- wait, wait, wait on hold and more waiting
Still nothing, Apple music support was clueless. I suggested to them that the issue may be that the credit cards are different for my wife and myself but they blew it off. Finally when I said I would do it myself, they said OK, try it. This worked. I had to change the credit cards to match and only then the entire family was able to use Apple Music. It did not take 2 days for the change to take effect. It was instantaneous. I asked for a free month of Apple Music for my multi-day trouble and was denied.
The only reason I am using Apple Music is because they have the family explicit filter. I would switch in a heartbeat to any other provider but they lack this simple feature.
I had trouble setting up a new Lenovo 110 17ikb to dual boot with Ubuntu on a Windows 10 machine. Here are some steps that I took to resolve this, including the to not so successful ones
- Started with just an install of Windows 10 on a new 2017 Lenovo 110 17ikb.
- I first freed up some space on the partition using diskmgmt.msc in Windows. I might have overdone it leaving 250GB.
- I had an existing Ubuntu bootable USB drive (16.04). Tried using the Windows 10 EFI boot from USB option with that drive (from the Recovery settings screen) but that did not work. System said that it could not find the USB drive on reboot.
- I then created a new USB ISO image (Ubuntu 16.10) using latest Rufus which should support BIOS and UEFI. Rebooted with USB as boot device but that did not work either. System did not find any bootable USB devices.
- I then created a new 16.04 USB ISO image (Ubuntu 16.04) using latest Rufus using same process as in previous step. Rebooted with USB as boot device but that did not work as well. System did not find any bootable USB devices.
- From the BIOS or UEFI settings I switched to Legacy mode and Legacy boot order (something like that). Moved Boot to USB to top in boot order. Now my USB drive was recognized on boot. The problem was that when trying to install Ubuntu it wanted to overwrite the entire drive (not install alongside Windows Boot Manager) so I had to stop this.
- I was about to give up here …
- I then tried to boot to an older Linux (FC9 i think) ISO CD that I had from before. Again selected EFI boot from CD/DVD. Again it did not work.
- I kept at it.
- I now burned a DVD ISO image (using ImgBurn) of the 16.10 version I downloaded eralier.
- Selected again to boot from EFI CD/DVD. Restarted PC and to my amazement it worked. It started up booting from the DVD. It booted into Ubuntu. I started the installation and it was successful. I did see the option to install Ubuntu alongside Windows Boot Manager. Now when starting up PC I can see options to boot into Ubuntu or Windows.
- The only unusual thing while installing Ubuntu was that I was not prompted to choose the free space partition I created in first step to install Ubuntu there. It luckily did install Ubuntu in this free partition. I would readd this step (it was there before) just to make installers a bit more certain that the correct location will be used.
- That’s it. Took much longer than it should have. Hope it helps someone.
A few days ago, I had a great idea to use Selenium IDE as automation tool for a brief demo. It would be a quick overview of a new set up in AWS, just to show that it works as well as it does already in other environments. I recorded a quick script in Selenium IDE, set the pause of three to five seconds between actions and timed execution for 90 seconds. It went great. When it was my turn, I hooked up the laptop to the main conference room screen, and started the Selenium IDE script, then minimized the pop up in Firefox. I stood by the screen pointing out the items that were being shown, the pages, clicks, forms populated, the correct URLs and what not. It went great and was perfectly on time. Actually it went so smooth, people though it was not live, but PowerPoint. Also, nothing was missed as the steps were previously though out well.
I think I will use this in future as well.
I am canceling our Spotify Family Membership due to lack of explicit filter.
I thought I read somewhere that if one of the family members is under 17 or 18 that it will automatically block the songs marked as Explicit. Boy was I wrong. Luckily I checked our kids accounts and it was all there. Red flag.
Not only is this desired for kids accounts, I personally also do not want to listen to songs (like many others) which have lyrics that are violent, demeaning, have explicit verses and similar.
For now it’s Bye Bye Spotify!