Reputation: 115
Here is the web code
<div data-module="OKVideo" data-options="{"playerId":"VideoPopup_player_1727943084608","width":"491","height":"275","notifyEnabled":true,"url":"https://st.mycdn.me/static/MegaPlayer/10-10-15/vp.swf","url11":"https://st.mycdn.me/static/MegaPlayer/10-10-15/vp11.swf","html5url":"//st.mycdn.me/static/MegaPlayer/10-11-50/okHtml5Player.min","minFlashVersionNewPlayer":"11.2","wmode":"opaque","asa":true,"provider":"UPLOADED_ODKL","flashvars":{"referer":"https://www.shahidpro.tv/","relatedAlways":"1","metadata":"{\"provider\":\"UPLOADED_ODKL\",\"service\":\"ok\",\"owner\":false,\"voted\":false,\"likeCount\":0,\"subscribed\":false,\"isWatchLater\":false,\"slot\":0,\"siteZone\":-1,\"showAd\":false,\"fromTime\":0,\"author\":{\"id\":\"565690732096\",\"name\":\"SAMR ZAN\",\"profile\":\"/profile/565690732096\"},\"movie\":{\"id\":\"1727943084608\",\"movieId\":\"1727943084608\",\"likeId\":\"1727943084608\",\"contentId\":\"834622982720\",\"poster\":\"https://i.mycdn.me/i?r=AEF0PjOBfKSCKs0AX-NHBglGBtoSnlj-w7r7-4MFAFw9g4biXbYyD2f2E83LOe0CGcT12ru7KHrHmBnSbxBCDBLP\\u0026fn=external_8\",\"duration\":\"1294\",\"title\":\"ikyn-133ar\",\"url\":\"https://www.ok.ru/video/1727943084608\",\"link\":\"/video/1727943084608\",\"collageInfo\":{\"url\":\"https://i.mycdn.me/i?r=AEE-HZfz734vGAKlsp5gLh-p5dsMcpUmst4efNIIuw5-O4biXbYyD2f2E83LOe0CGcTKJLHsazBXODze0CkTvfuB\",\"frequency\":10,\"height\":44,\"width\":80,\"count\":130},\"status\":\"OK\",\"statusText\":\"OK\",\"isLive\":false,\"notPublished\":false},\"admanMetadata\":{},\"partnerId\":0,\"ownerMovieId\":\"1727943084608\",\"alwaysShowRec\":false,\"videos\":[{\"name\":\"mobile\",\"url\":\"https://vd196.mycdn.me/?expires=1605039025583\\u0026srcIp=41.40.174.135\\u0026srcAg=CHROME\\u0026ms=45.136.22.4\\u0026type=4\\u0026sig=LW6aS8WtlvM\\u0026ct=0\\u0026urls=185.226.53.5\\u0026clientType=0\\u0026id=834622982720\",\"seekSchema\":3,\"disallowed\":false},{\"name\":\"lowest\",\"url\":\"https://vd196.mycdn.me/?expires=1605039025583\\u0026srcIp=41.40.174.135\\u0026srcAg=CHROME\\u0026ms=45.136.22.4\\u0026type=0\\u0026sig=npEpKHETvNw\\u0026ct=0\\u0026urls=185.226.53.5\\u0026clientType=0\\u0026id=834622982720\",\"seekSchema\":3,\"disallowed\":false},{\"name\":\"low\",\"url\":\"https://vd196.mycdn.me/?expires=1605039025583\\u0026srcIp=41.40.174.135\\u0026srcAg=CHROME\\u0026ms=45.136.22.4\\u0026type=1\\u0026sig=sZsahX1_3M4\\u0026ct=0\\u0026urls=185.226.53.5\\u0026clientType=0\\u0026id=834622982720\",\"seekSchema\":3,\"disallowed\":false},{\"name\":\"sd\",\"url\":\"https://vd196.mycdn.me/?expires=1605039025583\\u0026srcIp=41.40.174.135\\u0026srcAg=CHROME\\u0026ms=45.136.22.4\\u0026type=2\\u0026sig=MyZn0feEv34\\u0026ct=0\\u0026urls=185.226.53.5\\u0026clientType=0\\u0026id=834622982720\",\"seekSchema\":3,\"disallowed\":false},{\"name\":\"hd\",\"url\":\"https://vd196.mycdn.me/?expires=1605039025583\\u0026srcIp=41.40.174.135\\u0026srcAg=CHROME\\u0026ms=45.136.22.4\\u0026type=3\\u0026sig=F8Z1zwkFbnY\\u0026ct=0\\u0026urls=185.226.53.5\\u0026clientType=0\\u0026id=834622982720\",\"seekSchema\":3,\"disallowed\":false}],\"metadataEmbedded\":\"\\u003C?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\\u003E\\u003CMPD xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\" xmlns=\\\"urn:mpeg:DASH:schema:MPD:2011\\\" xsi:schemaLocation=\\\"urn:mpeg:DASH:schema:MPD:2011\\\" type=\\\"static\\\" mediaPresentationDuration=\\\"PT1294.97S\\\" minBufferTime=\\\"PT0.5S\\\" profiles=\\\"urn:mpeg:dash:profile:isoff-on-demand:2011\\\"\\u003E\\u003CPeriod id=\\\"0\\\" start=\\\"PT0S\\\" duration=\\\"PT1294.97S\\\"\\u003E\\u003CAdaptationSet id=\\\"0\\\" segmentAlignment=\\\"true\\\" subsegmentAlignment=\\\"true\\\" subsegmentStartsWithSAP=\\\"1\\\"\\u003E\\u003CRepresentation id=\\\"0\\\" bandwidth=\\\"122768\\\" width=\\\"256\\\" height=\\\"144\\\" quality=\\\"mobile\\\" frameRate=\\\"30\\\" codecs=\\\"avc1.64000C,mp4a.40.2\\\" audioSamplingRate=\\\"44100\\\" mimeType=\\\"video/mp4\\\" startWithSAP=\\\"1\\\"\\u003E\\u003CBaseURL\\u003Ehttps://vd196.mycdn.me/?expires=1605039025583\\u0026amp;srcIp=41.40.174.135\\u0026amp;srcAg=CHROME\\u0026amp;ms=45.136.22.4\\u0026amp;type=4\\u0026amp;sig=LW6aS8WtlvM\\u0026amp;ct=4\\u0026amp;urls=185.226.53.5\\u0026amp;clientType=0\\u0026amp;id=834622982720\\u003C/BaseURL\\u003E\\u003CSegmentBase indexRange=\\\"1342-2417\\\"\\u003E\\u003CInitialization range=\\\"0-1341\\\"/\\u003E\\u003C/SegmentBase\\u003E\\u003C/Representation\\u003E\\u003CRepresentation id=\\\"1\\\" bandwidth=\\\"359152\\\" width=\\\"426\\\" height=\\\"240\\\" quality=\\\"lowest\\\" frameRate=\\\"30\\\" codecs=\\\"avc1.640015,mp4a.40.2\\\" audioSamplingRate=\\\"44100\\\" mimeType=\\\"video/mp4\\\" startWithSAP=\\\"1\\\"\\u003E\\u003CBaseURL\\u003Ehttps://vd196.mycdn.me/?expires=1605039025583\\u0026amp;srcIp=41.40.174.135\\u0026amp;srcAg=CHROME\\u0026amp;ms=45.136.22.4\\u0026amp;type=0\\u0026amp;sig=npEpKHETvNw\\u0026amp;ct=4\\u0026amp;urls=185.226.53.5\\u0026amp;clientType=0\\u0026amp;id=834622982720\\u003C/BaseURL\\u003E\\u003CSegmentBase indexRange=\\\"1343-2418\\\"\\u003E\\u003CInitialization range=\\\"0-1342\\\"/\\u003E\\u003C/SegmentBase\\u003E\\u003C/Representation\\u003E\\u003CRepresentation id=\\\"2\\\" bandwidth=\\\"765536\\\" width=\\\"640\\\" height=\\\"360\\\" quality=\\\"low\\\" frameRate=\\\"30\\\" codecs=\\\"avc1.64001E,mp4a.40.2\\\" audioSamplingRate=\\\"44100\\\" mimeType=\\\"video/mp4\\\" startWithSAP=\\\"1\\\"\\u003E\\u003CBaseURL\\u003Ehttps://vd196.mycdn.me/?expires=1605039025583\\u0026amp;srcIp=41.40.174.135\\u0026amp;srcAg=CHROME\\u0026amp;ms=45.136.22.4\\u0026amp;type=1\\u0026amp;sig=sZsahX1_3M4\\u0026amp;ct=4\\u0026amp;urls=185.226.53.5\\u0026amp;clientType=0\\u0026amp;id=834622982720\\u003C/BaseURL\\u003E\\u003CSegmentBase indexRange=\\\"1344-2419\\\"\\u003E\\u003CInitialization range=\\\"0-1343\\\"/\\u003E\\u003C/SegmentBase\\u003E\\u003C/Representation\\u003E\\u003CRepresentation id=\\\"3\\\" bandwidth=\\\"1361072\\\" width=\\\"852\\\" height=\\\"480\\\" quality=\\\"sd\\\" frameRate=\\\"30\\\" codecs=\\\"avc1.64001F,mp4a.40.2\\\" audioSamplingRate=\\\"44100\\\" mimeType=\\\"video/mp4\\\" startWithSAP=\\\"1\\\"\\u003E\\u003CBaseURL\\u003Ehttps://vd196.mycdn.me/?expires=1605039025583\\u0026amp;srcIp=41.40.174.135\\u0026amp;srcAg=CHROME\\u0026amp;ms=45.136.22.4\\u0026amp;type=2\\u0026amp;sig=MyZn0feEv34\\u0026amp;ct=4\\u0026amp;urls=185.226.53.5\\u0026amp;clientType=0\\u0026amp;id=834622982720\\u003C/BaseURL\\u003E\\u003CSegmentBase indexRange=\\\"1344-2419\\\"\\u003E\\u003CInitialization range=\\\"0-1343\\\"/\\u003E\\u003C/SegmentBase\\u003E\\u003C/Representation\\u003E\\u003CRepresentation id=\\\"4\\\" bandwidth=\\\"2653949\\\" width=\\\"1280\\\" height=\\\"720\\\" quality=\\\"hd\\\" frameRate=\\\"30\\\" codecs=\\\"avc1.64001F,mp4a.40.2\\\" audioSamplingRate=\\\"44100\\\" mimeType=\\\"video/mp4\\\" startWithSAP=\\\"1\\\"\\u003E\\u003CBaseURL\\u003Ehttps://vd196.mycdn.me/?expires=1605039025583\\u0026amp;srcIp=41.40.174.135\\u0026amp;srcAg=CHROME\\u0026amp;ms=45.136.22.4\\u0026amp;type=3\\u0026amp;sig=F8Z1zwkFbnY\\u0026amp;ct=4\\u0026amp;urls=185.226.53.5\\u0026amp;clientType=0\\u0026amp;id=834622982720\\u003C/BaseURL\\u003E\\u003CSegmentBase indexRange=\\\"1343-2418\\\"\\u003E\\u003CInitialization range=\\\"0-1342\\\"/\\u003E\\u003C/SegmentBase\\u003E\\u003C/Representation\\u003E\\u003C/AdaptationSet\\u003E\\u003C/Period\\u003E\\u003C/MPD\\u003E\",\"metadataUrl\":\"https://vd196.mycdn.me/?expires=1605039025583\\u0026srcIp=41.40.174.135\\u0026srcAg=CHROME\\u0026ms=45.136.22.4\\u0026type=1\\u0026sig=sZsahX1_3M4\\u0026ct=6\\u0026urls=185.226.53.5\\u0026clientType=0\\u0026id=834622982720\",\"hlsManifestUrl\":\"https://vd379.mycdn.me/video.m3u8?cmd=videoPlayerCdn\\u0026expires=1605039025583\\u0026srcIp=41.40.174.135\\u0026srcAg=CHROME\\u0026ms=185.226.52.74\\u0026type=4\\u0026sig=wobTwftQXMY\\u0026ct=8\\u0026urls=45.136.21.8\\u0026clientType=0\\u0026id=834622982720\",\"failoverHosts\":[\"vd296.mycdn.me\"],\"autoplay\":{\"autoplayEnabled\":true,\"timeFromEnabled\":true,\"noRec\":false,\"fullScreenExit\":false,\"vitrinaSection\":\"recommended_movie\"},\"security\":{\"url\":\"https://vd196.mycdn.me/usr_login\",\"cookie\":\"vdsig\"},\"p2pInfo\":{\"isPeerEnabled\":false,\"ubsc\":0,\"pbsc\":0,\"mptpc\":0,\"pctmt\":0,\"pbesc\":0,\"prrt\":0,\"srt\":0,\"swrt\":0,\"dctt\":0},\"stunServers\":[{\"urls\":[\"stun:videostun.mycdn.me\"]}]}","saveLastPlayingTimeFrom":"30","castId":"559D7832","locale":"en","noChatLikes":"1","noChannel":"1","webmSec":"20","enabledLocalStorage":"1","minCacheTime":"120","maxCachePartOfDurationMQ":"30","checkMQ":"1","noTrailer":"1","recSlot":"7178","noLikeButton":"1","maxCachePartOfDuration":"10","isAnonym":"1","jidx":"1","hideWatermark":"0","isEmbed":"1","noOkliveBanner":"1","minCacheTimeMQ":"20","ldChunk":"2000","showChat":"1","ldBuffer":"6000","feedAdLogic":"15,3,3,14400","location":"AnonymVideoEmbed/anonymVideoEmbed/anonym","hideExpand":"1","adLogic":"15,0,3,14400","checkAutoplayBrowsers":"safari,chrome,opera,yandex,firefox"},"liveRertyTimeout":5000,"poster":"https://i.mycdn.me/i?r=AEF0PjOBfKSCKs0AX-NHBglGBtoSnlj-w7r7-4MFAFw9g4biXbYyD2f2E83LOe0CGcT12ru7KHrHmBnSbxBCDBLP\u0026fn=external_8","isExternalPlayer":false,"isIframePlayer":false,"isHtml5Player":true,"timestamp":"1604952625588","stubEnabled":false,"verifyInline":false,"webrtcBrokenH264":false}" data-player-container-id="embedVideoC" data-player-element-id="embedVideoE" data-visible-part="1" data-use-events-for-showing="true" class="vid-card_cnt h-mod"><div class="vid-card_cnt_w" data-l="t,play" id="embedVideoC"><div class="vid_play"><svg class="svg-ic svg-ico_media_play_16 svg-ic48 vid_play-ic" viewBox="0 0 16 16">
<path d="M5 4.072a.7.7 0 0 1 1.122-.559l5.204 3.928a.699.699 0 0 1 0 1.118l-5.204 3.928A.7.7 0 0 1 5 11.928V4.072z" fill-rule="evenodd" class="svg-fill"></path>
</svg></div><img src="https://i.mycdn.me/i?r=AEF0PjOBfKSCKs0AX-NHBglGBtoSnlj-w7r7-4MFAFw9g4biXbYyD2f2E83LOe0CGcT12ru7KHrHmBnSbxBCDBLP&fn=external_8" class="vid-card_img" style=""><div class="vid-card_duration-w"><div class="vid-card_duration">21:34</div></div><div class="vid-card_n_w"><span class="vid-card_n">ikyn-133ar</span></div></div></div>
I am trying to check if data-module exists or not:
WebDriverWait(browser, 20).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"#Playerholder > iframe")))
x = WebDriverWait(browser, 10).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '#embedVideoC > div'))
Upvotes: 1
Views: 575
Reputation: 4869
If you just want to test presence of attribute, try
if x.get_attribute('data-module'):
print('TRUE')
else:
print('FALSE')
Upvotes: 1
Reputation: 651
something like this should work:
driver.find_element_by_css_selector('div[data-module]')
Upvotes: 2