delfin123 / 5-startit-movie-finder-delfin123

0 stars 0 forks source link

Potentially wrong element will be found - css selector is to broad #1

Open Xotabu4 opened 6 years ago

Xotabu4 commented 6 years ago

Your code:

let foundTitles = $$(`[_ngcontent-c1]>[class*="flex"] [class*="ellipsis"]>a`);

Locator [class*="flex"] potentially can be triggered for element: <dib class="flexible"> or <dib class="unflex"> since it does include logic for string, instead of . selector - $('.flex') which does searching by class more safely and correctly - by splitting by space and then full match.

https://github.com/delfin123/5-startit-movie-finder-delfin123/blob/master/Hometask3/search.ts#L23 https://github.com/delfin123/5-startit-movie-finder-delfin123/blob/master/Hometask3/search.ts#L37

delfin123 commented 6 years ago

fixed