refactored to DRY with check_script_tag
change has_css to has_selector