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

After switching chanel stuck at finding "selectBtn" because drop-down menu lack, #118

Merged
merged 5 commits into from Jul 2, 2022

Conversation

sacredrel1c
Copy link
Contributor

@sacredrel1c sacredrel1c commented Jun 26, 2022

This change is Reviewable

…ick on create Button 2) add video), then drop-down shows and algo continue.
…ick on create Button 2) add video), then drop-down shows and algo continue.
@fawazahmed0
Copy link
Owner

I don't think this code will work, it has many issues. Please test it

Copy link
Owner

@fawazahmed0 fawazahmed0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add await

        if((await page.waitForXPath(createBtnXPath))){
            const createBtn = await page.$x(createBtnXPath);
            await createBtn[0].click();
        }
        if((await page.waitForXPath(addVideoBtnXPath))){
            const addVideoBtn =await page.$x(addVideoBtnXPath);
            await addVideoBtn[0].click();
        }

after adding the requested changes, please test it.

@sacredrel1c
Copy link
Contributor Author

i'm use vanilla js version, but i add yield instead of await

@sacredrel1c
Copy link
Contributor Author

sacredrel1c commented Jun 26, 2022

Вам нужно добавить ожидание

        if((await page.waitForXPath(createBtnXPath))){
            const createBtn = await page.$x(createBtnXPath);
            await createBtn[0].click();
        }
        if((await page.waitForXPath(addVideoBtnXPath))){
            const addVideoBtn =await page.$x(addVideoBtnXPath);
            await addVideoBtn[0].click();
        }

после добавления запрошенных изменений проверьте его.

const createBtnXPath = '//*[@id="create-icon"]/tp-yt-iron-icon';
        const addVideoBtnXPath = '//*[@id="text-item-0"]/ytcp-ve/div/div/yt-formatted-string';
        if(yield page.waitForXPath(createBtnXPath)){
            const createBtn = yield page.$x(createBtnXPath);
            createBtn[0].click();
        }
        if(yield page.waitForXPath(addVideoBtnXPath)){
            const addVideoBtn = yield page.$x(addVideoBtnXPath);
            addVideoBtn[0].click();
        }

it work for me, and when i use other account i don't need this, because drop-down menu exist. and your code work fine.

@fawazahmed0
Copy link
Owner

I will merge this PR, after someone test it

@sacredrel1c sacredrel1c reopened this Jul 1, 2022
@fawazahmed0
Copy link
Owner

Thanks for this PR

@fawazahmed0 fawazahmed0 merged commit 6705daa into fawazahmed0:main Jul 2, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants