Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化建议:支持操作多个浏览器 #115

Open
poscergx opened this issue Jun 7, 2022 · 1 comment
Open

优化建议:支持操作多个浏览器 #115

poscergx opened this issue Jun 7, 2022 · 1 comment

Comments

@poscergx
Copy link

poscergx commented Jun 7, 2022

支持打开多个浏览器,可以依据用例切换浏览器进行操作

defnngj added a commit that referenced this issue Jun 7, 2022
@defnngj
Copy link
Collaborator

defnngj commented Jun 25, 2022

  • 升级seldom 2.10.2 版本

可以通过self.new_browser()打开新的浏览器, 不过只能写 selenium 的API ,目前没有想到更少的方式支持多浏览器。

import seldom


class BaiduTest(seldom.TestCase):

    def open_new_browser(self):
        """selenium api"""
        new_driver = self.new_browser()
        new_driver.get("http://www.bing.com")
        new_driver.find_element("id", "sb_form_q").send_keys("XTestRunner")
        new_driver.find_element("id", "sb_form_q").submit()
        self.sleep(2)

    def test_case(self):
        """a simple test case """
        self.open("https://m.baidu.com")
        # open new browser
        self.open_new_browser()

        self.type(id_="index-kw", text="seldom")
        self.click(id_="index-bn")
        self.assertTitle("seldom - 百度")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants