fab_when_impl.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:directory-tests 作者: uktrade 项目源码 文件源码
def fas_get_company_profile_url(response: Response, name: str) -> str:
    content = response.content.decode("utf-8")
    links_to_profiles_selector = "#ed-search-list-container a"
    href_selector = "a::attr(href)"
    links_to_profiles = Selector(text=content).css(
        links_to_profiles_selector).extract()
    profile_url = None
    for link in links_to_profiles:
        if escape_html(name).lower() in escape_html(link).lower():
            profile_url = Selector(text=link).css(href_selector).extract()[0]
    with assertion_msg(
            "Couldn't find link to '%s' company profile page in the response",
            name):
        assert profile_url
    return profile_url
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号