Fixing if statement to utilize has_selector in page object