If you get this error when doing selenium browser testing
“Element is not currently visible and so may not be interacted with”
it means that you have to check a few things.
2) Make sure you are referring only to the one and only correct element. Sometimes, you might have 2 elements with the same id (some apps are naughty). Print out the source and check. It could be possible that you are calling the element or its parent which was hidden.
I’ve verified that this is not a selenium bug.
most people restrict their browser testing within a site. However, with a shopping cart or subscription application for example, the testing should really end only after the user receives the email as anything could happen between the moment email is sent and received. Email testing can be tricky. How does one automate the process of checking emails and verifying the right email has been sent without too much of a hassle? Well, the trick is to setup an internal mail server and install a HTML capable email client within the test machine.
Here, I’m going to quickly set up my virtual machine to handle sending and receiving of internal mails.
1. Install dovecot bundle
sudo apt-get install dovecot-imapd dovecot-postfix
(When asked to configure postfix, choose “localhost only”. We don’t want to accidentally send email to the outside world)
2. Create a new test user for testing
3. Install squirrelmail (Any other web-based client is fine as well). Remember to log in as the test user and set HTML email as the default first.
4. When running the browser test or BDD, use email@example.com as user’s email. When logged into squirrelmail, you can then automate the checking and clicking of the test receipt links.
rather than using complicated functions to try and test file downloads, we can use simple logic like if the download is successful, we should see title A and if download fails, we should see title B. Surely, our system wouldn’t spit out the same page title even if the file doesn’t exists. So using phpwebdriver for example, say I am trying to check if the download link is working in the thankyou page:
// thankyou page
$this->assertEquals(self::$session->element('xpath', '//td[@class="product-name"]/small/a')->text(), "Download file now");
// now click on the download file link.
// wait for a 2 secs for the download now prompt.
// if file exists, then I should see the "Order Received" as part of the page title header.
$this->assertRegExp('/Order Received/', self::$session->title());