Rayrun
← Back to Discord Forum

playwright navigation issue

frame.wait_for_selector('[data-label="Name"]')

# Extract and print the names
    td_elements = frame.query_selector_all('a[target="_top"]') # we are getting oll the link using dat
    for td_element in td_elements:
        with context.new_page() as page:
        # Ctrl+Click to open link in a new tab
            td_element.click(modifiers=['Control'])

        # Wait for the new tab to open and load
            page.wait_for_load_state('networkidle')

        # Wait for the new tab to open
            
        
            data_dict = {}
            frame_2 = page.frame(name='dnn_ctr4429_IFrame_htmIFrame')
            frame_2.wait_for_load_state('load')

            dd_element = frame_2.locator('#ORGNAME')
            data_dict['business name'] = dd_element.text_content()
            data_list.append(data_dict)
            dl_elements = frame_2.query_selector_all('dl.dl-horizontal')
            for dl_element in dl_elements:
                dt_elements = dl_element.query_selector_all('dt')
                dd_elements = dl_element.query_selector_all('dd')
                for dt_element, dd_element in zip(dt_elements, dd_elements):
                    dt_text = dt_element.text_content().strip()
                    dd_text = dd_element.text_content().strip()
                 
        data_list.append(data_dict)
        page.close(
        page.wait_for_timeout(5000)
                
        print(data_dict)
         i am trying to open the list of td_elements which are java script fuction activated with a click  . i am facing error as the new open tab closes immdietly  without waiting for being network idle

This thread is trying to answer question "Why does the new tab close immediately without waiting for being network idle when trying to open a list of 'td_elements' with a click in Playwright?"

1 reply

any help ?

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.